-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
edae93e
commit f7c83f9
Showing
3 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class UpdateBannerType1710312104956 implements MigrationInterface { | ||
name = 'UpdateBannerType1710312104956'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query('ALTER TYPE banner_type_enum ADD VALUE \'chronicled\''); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query('CREATE TYPE "banner_type_enum_old" AS ENUM(\'beginners\', \'standard\', \'characters\', \'weapons\')'); | ||
await queryRunner.query('ALTER TABLE "banner" ALTER COLUMN "type" TYPE "banner_type_enum_old" USING "type"::"text"::"banner_type_enum_old"'); | ||
await queryRunner.query('DROP TYPE "banner_type_enum"'); | ||
await queryRunner.query('ALTER TYPE "banner_type_enum_old" RENAME TO "banner_type_enum"'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
import { Banner } from '../entities/banner'; | ||
|
||
const banner = { | ||
name: 'Ode to the Dawn Breeze', | ||
start: '2024-03-13 06:00:00', | ||
end: '2024-04-02 17:59:00', | ||
id: 500001, | ||
}; | ||
|
||
export class UpdateBanner1710312547170 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
const newBanner = new Banner(); | ||
newBanner.id = banner.id; | ||
newBanner.type = 'chronicled'; | ||
newBanner.name = banner.name; | ||
newBanner.start = `${banner.start}+8`; | ||
newBanner.end = `${banner.end}+8`; | ||
|
||
await queryRunner.manager.save(newBanner); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.manager.delete(Banner, [500001]); | ||
} | ||
} |