Remove tabela CarBrands e inclui rotas para recuperar marcas e modelos
This commit is contained in:
28
src/database/migrations/1661745915711-DropCarBrandsTable.ts
Normal file
28
src/database/migrations/1661745915711-DropCarBrandsTable.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import {MigrationInterface, QueryRunner, Table} from "typeorm";
|
||||
|
||||
export class DropCarBrandsTable1661745915711 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.dropTable('carBrands')
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.createTable(
|
||||
new Table({
|
||||
name: 'carModels',
|
||||
columns: [
|
||||
{
|
||||
name: 'id_brand',
|
||||
type: 'uuid',
|
||||
isPrimary: true,
|
||||
generationStrategy: 'uuid',
|
||||
default: 'uuid_generate_v4()',
|
||||
},
|
||||
{
|
||||
name: 'name',
|
||||
type: 'varchar',
|
||||
}
|
||||
],
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user