Alterando lógica das rotas de vans e MER da tabela Vans
This commit is contained in:
@@ -6,16 +6,10 @@ export class CreateVansTable1655691282002 implements MigrationInterface {
|
||||
new Table({
|
||||
name: 'vans',
|
||||
columns: [
|
||||
{
|
||||
name: 'id_van',
|
||||
type: 'uuid',
|
||||
isPrimary: true,
|
||||
generationStrategy: 'uuid',
|
||||
default: 'uuid_generate_v4()',
|
||||
},
|
||||
{
|
||||
name: 'plate',
|
||||
type: 'varchar',
|
||||
isPrimary: true,
|
||||
},
|
||||
{
|
||||
name: 'brand',
|
||||
@@ -30,7 +24,32 @@ export class CreateVansTable1655691282002 implements MigrationInterface {
|
||||
type: 'numeric',
|
||||
},
|
||||
{
|
||||
name: 'document',
|
||||
name: 'document_status',
|
||||
type: 'boolean',
|
||||
isNullable: true
|
||||
},
|
||||
{
|
||||
name: 'locator_name',
|
||||
type: 'varchar',
|
||||
isNullable: true
|
||||
},
|
||||
{
|
||||
name: 'locator_address',
|
||||
type: 'varchar',
|
||||
isNullable: true
|
||||
},
|
||||
{
|
||||
name: 'locator_complement',
|
||||
type: 'varchar',
|
||||
isNullable: true
|
||||
},
|
||||
{
|
||||
name: 'locator_city',
|
||||
type: 'varchar',
|
||||
isNullable: true
|
||||
},
|
||||
{
|
||||
name: 'locator_state',
|
||||
type: 'varchar',
|
||||
isNullable: true
|
||||
},
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
import { MigrationInterface, QueryRunner, Table } from 'typeorm';
|
||||
|
||||
export class CreateVanLocatorTable1655692363126 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.createTable(
|
||||
new Table({
|
||||
name: 'vanLocator',
|
||||
columns: [
|
||||
{
|
||||
name: 'id_vanLocator',
|
||||
type: 'uuid',
|
||||
isPrimary: true,
|
||||
generationStrategy: 'uuid',
|
||||
default: 'uuid_generate_v4()',
|
||||
},
|
||||
{
|
||||
name: 'name',
|
||||
type: 'varchar',
|
||||
},
|
||||
{
|
||||
name: 'address',
|
||||
type: 'varchar',
|
||||
},
|
||||
{
|
||||
name: 'complement',
|
||||
type: 'varchar',
|
||||
},
|
||||
{
|
||||
name: 'city',
|
||||
type: 'varchar',
|
||||
},
|
||||
{
|
||||
name: 'state',
|
||||
type: 'varchar',
|
||||
},
|
||||
{
|
||||
name: 'created_at',
|
||||
type: 'timestamp',
|
||||
default: 'now()',
|
||||
},
|
||||
{
|
||||
name: 'updated_at',
|
||||
type: 'timestamp',
|
||||
default: 'now()',
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.dropTable('vanLocator');
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
import { MigrationInterface, QueryRunner, Table } from 'typeorm';
|
||||
|
||||
export class CreateVanDocumentsTable1655692498005
|
||||
implements MigrationInterface
|
||||
{
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.createTable(
|
||||
new Table({
|
||||
name: 'vanDocuments',
|
||||
columns: [
|
||||
{
|
||||
name: 'document_van',
|
||||
type: 'varchar',
|
||||
isPrimary: true,
|
||||
},
|
||||
{
|
||||
name: 'vanLocator_id',
|
||||
type: 'uuid',
|
||||
},
|
||||
{
|
||||
name: 'document_status',
|
||||
type: 'varchar',
|
||||
},
|
||||
{
|
||||
name: 'created_at',
|
||||
type: 'timestamp',
|
||||
default: 'now()',
|
||||
},
|
||||
{
|
||||
name: 'updated_at',
|
||||
type: 'timestamp',
|
||||
default: 'now()',
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.dropTable('vanDocuments');
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
import { MigrationInterface, QueryRunner, TableForeignKey } from 'typeorm';
|
||||
|
||||
export class AddFKVanLocatorIdToVanDocumentsTable1655692624024
|
||||
implements MigrationInterface
|
||||
{
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.createForeignKey(
|
||||
'vanDocuments',
|
||||
new TableForeignKey({
|
||||
name: 'VanLocatorVanDocuments', // nome da FK, serve para referenciar numa exclusão pelo QueryRunner se necessário
|
||||
columnNames: ['vanLocator_id'], // coluna que vai virar FK
|
||||
referencedColumnNames: ['id_vanLocator'], // coluna PK da primeira tabela
|
||||
referencedTableName: 'vanLocator', // nome da tabela que possui a PK
|
||||
onDelete: 'SET NULL',
|
||||
onUpdate: 'CASCADE',
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.dropForeignKey(
|
||||
'vanDocuments',
|
||||
'VanLocatorVanDocuments',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
import { MigrationInterface, QueryRunner, TableForeignKey } from 'typeorm';
|
||||
|
||||
export class AddFKVanDocumentToVanDocumentsTable1655696991836
|
||||
implements MigrationInterface
|
||||
{
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.createForeignKey(
|
||||
'vanDocuments',
|
||||
new TableForeignKey({
|
||||
name: 'VanDocumentVanDocuments', // nome da FK, serve para referenciar numa exclusão pelo QueryRunner se necessário
|
||||
columnNames: ['document_van'], // coluna que vai virar FK
|
||||
referencedColumnNames: ['document'], // coluna PK da primeira tabela
|
||||
referencedTableName: 'vanDocuments', // nome da tabela que possui a PK
|
||||
onDelete: 'SET NULL',
|
||||
onUpdate: 'CASCADE',
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.dropForeignKey('vanDocuments', 'VanDocumentVanDocuments');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user