From abe5563219bed1cedfb60d4441b3c325b58130fe Mon Sep 17 00:00:00 2001 From: Nikhil Dange Date: Tue, 26 Mar 2024 23:09:27 -0700 Subject: [PATCH] migration and edited model --- .../0042-remove-users-lastLogin-column.ts | 17 +++++++++++++++++ models/UserModel.ts | 3 --- 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 migrations/0042-remove-users-lastLogin-column.ts diff --git a/migrations/0042-remove-users-lastLogin-column.ts b/migrations/0042-remove-users-lastLogin-column.ts new file mode 100644 index 00000000..8a605184 --- /dev/null +++ b/migrations/0042-remove-users-lastLogin-column.ts @@ -0,0 +1,17 @@ +import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; + +const TABLE_NAME = 'Users'; + +export class RemoveUsersLastLoginColumn1711518997063 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.dropColumn(TABLE_NAME, 'lastLogin'); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.addColumn(TABLE_NAME, new TableColumn({ + name: 'lastLogin', + type: 'timestampz', + default: 'CURRENT_TIMESTAMP(6)', + })); + } +} diff --git a/models/UserModel.ts b/models/UserModel.ts index 6f4e09cb..677ec3f1 100644 --- a/models/UserModel.ts +++ b/models/UserModel.ts @@ -65,9 +65,6 @@ export class UserModel extends BaseEntity { @Column('integer', { default: 0 }) credits: number; - @Column('timestamptz', { default: () => 'CURRENT_TIMESTAMP(6)' }) - lastLogin: Date; - @OneToMany((type) => ActivityModel, (activity) => activity.user, { cascade: true }) activities: ActivityModel[];