Adicionando rotas e lógica para Vans e Locadores de Vans
This commit is contained in:
50
src/database/migrations/1655691282002-CreateVansTable.ts
Normal file
50
src/database/migrations/1655691282002-CreateVansTable.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { MigrationInterface, QueryRunner, Table } from 'typeorm';
|
||||
|
||||
export class CreateVansTable1655691282002 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.createTable(
|
||||
new Table({
|
||||
name: 'vans',
|
||||
columns: [
|
||||
{
|
||||
name: 'id_van',
|
||||
type: 'uuid',
|
||||
isPrimary: true,
|
||||
generationStrategy: 'uuid',
|
||||
default: 'uuid_generate_v4()',
|
||||
},
|
||||
{
|
||||
name: 'plate',
|
||||
type: 'varchar',
|
||||
},
|
||||
{
|
||||
name: 'brand',
|
||||
type: 'varchar',
|
||||
},
|
||||
{
|
||||
name: 'model',
|
||||
type: 'varchar',
|
||||
},
|
||||
{
|
||||
name: 'seats_number',
|
||||
type: 'numeric',
|
||||
},
|
||||
{
|
||||
name: 'created_at',
|
||||
type: 'timestamp',
|
||||
default: 'now()',
|
||||
},
|
||||
{
|
||||
name: 'updated_at',
|
||||
type: 'timestamp',
|
||||
default: 'now()',
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.dropTable('vans');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user