|
| 1 | +import { MigrationInterface, QueryRunner } from "typeorm"; |
| 2 | + |
| 3 | +export class addTransportationTable1768335982284 implements MigrationInterface { |
| 4 | + name = 'addTransportationTable1768335982284' |
| 5 | + |
| 6 | + public async up(queryRunner: QueryRunner): Promise<void> { |
| 7 | + await queryRunner.query(` |
| 8 | + CREATE TABLE \`transportations\` ( |
| 9 | + \`id\` int NOT NULL AUTO_INCREMENT, |
| 10 | + \`user_id\` int NOT NULL, |
| 11 | + \`year\` int NULL, |
| 12 | + \`key\` int NOT NULL, |
| 13 | + \`departure_time\` varchar(255) NULL, |
| 14 | + \`description\` varchar(1000) NULL, |
| 15 | + \`created_at\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), |
| 16 | + \`updated_at\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), |
| 17 | + UNIQUE INDEX \`IDX_786464b82be79319c981bfd00a\` (\`user_id\`, \`key\`, \`year\`), |
| 18 | + INDEX \`transportations_users_idx\` (\`user_id\`), |
| 19 | + PRIMARY KEY (\`id\`) |
| 20 | + ) ENGINE = InnoDB |
| 21 | + `); |
| 22 | + } |
| 23 | + |
| 24 | + public async down(queryRunner: QueryRunner): Promise<void> { |
| 25 | + await queryRunner.query(` |
| 26 | + DROP INDEX \`transportations_users_idx\` ON \`transportations\` |
| 27 | + `); |
| 28 | + await queryRunner.query(` |
| 29 | + DROP INDEX \`IDX_786464b82be79319c981bfd00a\` ON \`transportations\` |
| 30 | + `); |
| 31 | + await queryRunner.query(` |
| 32 | + DROP TABLE \`transportations\` |
| 33 | + `); |
| 34 | + } |
| 35 | + |
| 36 | +} |
0 commit comments