This repository has been archived by the owner on Dec 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Showing
5 changed files
with
656 additions
and
536 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
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 |
---|---|---|
@@ -1,34 +1,45 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class updateTable1901666580390462 implements MigrationInterface { | ||
name = 'updateTable1901666580390462' | ||
name = 'updateTable1901666580390462'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`CREATE TABLE \`shared\` (\`createdAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`uuid\` int NOT NULL AUTO_INCREMENT, \`uniqueID\` varchar(36) NOT NULL, \`projectID\` int NOT NULL, PRIMARY KEY (\`uuid\`)) ENGINE=InnoDB`); | ||
await queryRunner.query(`ALTER TABLE \`api_data\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`api_data\` ADD \`name\` varchar(255) NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE \`api_group\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`api_group\` ADD \`name\` varchar(255) NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE \`project\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`project\` ADD \`name\` varchar(255) NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE \`mock\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`mock\` ADD \`name\` varchar(255) NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE \`environment\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`environment\` ADD \`name\` varchar(255) NOT NULL`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`environment\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`environment\` ADD \`name\` varchar(500) NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE \`mock\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`mock\` ADD \`name\` varchar(500) NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE \`project\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`project\` ADD \`name\` varchar(500) NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE \`api_group\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`api_group\` ADD \`name\` varchar(500) NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE \`api_data\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`api_data\` ADD \`name\` varchar(500) NOT NULL`); | ||
await queryRunner.query(`DROP TABLE \`shared\``); | ||
} | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`CREATE TABLE \`shared\` (\`createdAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`uuid\` int NOT NULL AUTO_INCREMENT, \`uniqueID\` varchar(36) NOT NULL, \`projectID\` int NOT NULL, PRIMARY KEY (\`uuid\`)) ENGINE=InnoDB`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE \`api_group\` modify column \`name\` varchar(500) NOT NULL`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE \`environment\` modify column \`name\` varchar(500) NOT NULL`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE \`project\` modify column \`name\` varchar(500) NOT NULL`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE \`mock\` modify column \`name\` varchar(500) NOT NULL`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE \`api_data\` modify column \`name\` varchar(500) NOT NULL`, | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE \`api_data\` modify column \`name\` varchar(255) NOT NULL`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE \`mock\` modify column \`name\` varchar(255) NOT NULL`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE \`project\` modify column \`name\` varchar(255) NOT NULL`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE \`environment\` modify column \`name\` varchar(255) NOT NULL`, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE \`api_group\` modify column \`name\` varchar(255) NOT NULL`, | ||
); | ||
await queryRunner.query(`DROP TABLE \`shared\``); | ||
} | ||
} |
Oops, something went wrong.