delete
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddSoftDeleteToListsAndTemplates1781300000000
|
||||
implements MigrationInterface
|
||||
{
|
||||
name = 'AddSoftDeleteToListsAndTemplates1781300000000';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
'ALTER TABLE `user_lists` ADD `deletedAt` datetime(3) NULL',
|
||||
);
|
||||
await queryRunner.query(
|
||||
'ALTER TABLE `list_templates` ADD `deletedAt` datetime(3) NULL',
|
||||
);
|
||||
await queryRunner.query(
|
||||
'CREATE INDEX `IDX_user_lists_deleted_at` ON `user_lists` (`deletedAt`)',
|
||||
);
|
||||
await queryRunner.query(
|
||||
'CREATE INDEX `IDX_list_templates_deleted_at` ON `list_templates` (`deletedAt`)',
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
'DROP INDEX `IDX_list_templates_deleted_at` ON `list_templates`',
|
||||
);
|
||||
await queryRunner.query(
|
||||
'DROP INDEX `IDX_user_lists_deleted_at` ON `user_lists`',
|
||||
);
|
||||
await queryRunner.query('ALTER TABLE `list_templates` DROP COLUMN `deletedAt`');
|
||||
await queryRunner.query('ALTER TABLE `user_lists` DROP COLUMN `deletedAt`');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user