Skip to content

Commit

Permalink
migration and edited model
Browse files Browse the repository at this point in the history
  • Loading branch information
nik-dange committed Mar 27, 2024
1 parent 5849581 commit abe5563
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
17 changes: 17 additions & 0 deletions migrations/0042-remove-users-lastLogin-column.ts
Original file line number Diff line number Diff line change
@@ -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<void> {
await queryRunner.dropColumn(TABLE_NAME, 'lastLogin');
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.addColumn(TABLE_NAME, new TableColumn({
name: 'lastLogin',
type: 'timestampz',
default: 'CURRENT_TIMESTAMP(6)',
}));
}
}
3 changes: 0 additions & 3 deletions models/UserModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];

Expand Down

0 comments on commit abe5563

Please sign in to comment.