Skip to content

Commit

Permalink
fix(migration): fix incorrect migration naming (#4809)
Browse files Browse the repository at this point in the history
  • Loading branch information
sogehige committed Sep 7, 2021
1 parent 9667e31 commit deade37
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class globalFontForAlerts1613738901696 implements MigrationInterface {
name = 'globalFontForAlerts16137389016965';
name = 'globalFontForAlerts1613738901696';

public async up(queryRunner: QueryRunner): Promise<void> {
// remove old migration
const response = await queryRunner.query(`SELECT * FROM \`migrations\` WHERE \`name\`='globalFontForAlerts16137389016965'`);
if (response.length > 0) {
await queryRunner.query(`DELETE FROM \`migrations\` WHERE \`name\`='globalFontForAlerts16137389016965'`);
console.log('Skipping migration globalFontForAlerts1613738901696 -> updating globalFontForAlerts16137389016965 to globalFontForAlerts1613738901696');
return;
}

await queryRunner.query('ALTER TABLE `alert` ADD `font` text NOT NULL');
await queryRunner.query('ALTER TABLE `alert` ADD `fontMessage` text NOT NULL');
await queryRunner.query('ALTER TABLE `alert_follow` CHANGE `font` `font` text NULL');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class globalFontForAlerts1613738901696 implements MigrationInterface {
name = 'globalFontForAlerts16137389016965';
name = 'globalFontForAlerts1613738901696';

public async up(queryRunner: QueryRunner): Promise<void> {
// remove old migration
const response = await queryRunner.query(`SELECT * FROM "migrations" WHERE "name"='globalFontForAlerts16137389016965'`);
if (response.length > 0) {
await queryRunner.query(`DELETE FROM "migrations" WHERE "name"='globalFontForAlerts16137389016965'`);
console.log('Skipping migration globalFontForAlerts1613738901696 -> updating globalFontForAlerts16137389016965 to globalFontForAlerts1613738901696');
return;
}
await queryRunner.query(`ALTER TABLE "alert" ADD "font" text NOT NULL`);
await queryRunner.query(`ALTER TABLE "alert" ADD "fontMessage" text NOT NULL`);
await queryRunner.query(`ALTER TABLE "alert_follow" ALTER COLUMN "font" DROP NOT NULL`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class globalFontForAlerts1613738901696 implements MigrationInterface {
name = 'globalFontForAlerts16137389016965';
name = 'globalFontForAlerts1613738901696';

public async up(queryRunner: QueryRunner): Promise<void> {
// remove old migration
const response = await queryRunner.query(`SELECT * FROM "migrations" WHERE "name"='globalFontForAlerts16137389016965'`);
if (response.length > 0) {
await queryRunner.query(`DELETE FROM "migrations" WHERE "name"='globalFontForAlerts16137389016965'`);
console.log('Skipping migration globalFontForAlerts1613738901696 -> updating globalFontForAlerts16137389016965 to globalFontForAlerts1613738901696');
return;
}

// get all alerts
const alerts = {} as any;
for (const type of [
Expand Down

0 comments on commit deade37

Please sign in to comment.