parent
ad24c4ac05
commit
5f0afdd23c
@ -0,0 +1,14 @@ |
|||||||
|
import { DataSource } from "typeorm"; |
||||||
|
|
||||||
|
export default new DataSource({ |
||||||
|
type: 'mysql', |
||||||
|
host: 'localhost', |
||||||
|
port: 3306, |
||||||
|
username: 'root', |
||||||
|
password: 'init00!!', |
||||||
|
database: 'test_db', |
||||||
|
entities: ['src/**/*.entity.ts'], |
||||||
|
migrations: ['src/database/migrations/*.ts'], |
||||||
|
migrationsTableName: 'migrations', |
||||||
|
synchronize: false |
||||||
|
}); |
@ -0,0 +1,11 @@ |
|||||||
|
import { MigrationInterface, QueryRunner } from "typeorm"; |
||||||
|
|
||||||
|
export class Migration1750406542391 implements MigrationInterface { |
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> { |
||||||
|
} |
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> { |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,15 @@ |
|||||||
|
import { MigrationInterface, QueryRunner } from "typeorm"; |
||||||
|
|
||||||
|
export class Migration1750406588424 implements MigrationInterface { |
||||||
|
name = 'Migration1750406588424' |
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> { |
||||||
|
await queryRunner.query(`CREATE TABLE \`user\` (\`id\` int NOT NULL AUTO_INCREMENT, \`name\` varchar(255) NOT NULL, \`email\` varchar(255) NOT NULL, UNIQUE INDEX \`IDX_e12875dfb3b1d92d7d7c5377e2\` (\`email\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); |
||||||
|
} |
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> { |
||||||
|
await queryRunner.query(`DROP INDEX \`IDX_e12875dfb3b1d92d7d7c5377e2\` ON \`user\``); |
||||||
|
await queryRunner.query(`DROP TABLE \`user\``); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
import { MigrationInterface, QueryRunner } from "typeorm"; |
||||||
|
|
||||||
|
export class Migration1750406841786 implements MigrationInterface { |
||||||
|
name = 'Migration1750406841786' |
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> { |
||||||
|
await queryRunner.query(`ALTER TABLE \`user\` ADD \`password\` varchar(255) NOT NULL`); |
||||||
|
} |
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> { |
||||||
|
await queryRunner.query(`ALTER TABLE \`user\` DROP COLUMN \`password\``); |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue