feat(migrations): 🚧 Create migrations of tables (routes, neighborhoods served, destinations, passengers and route historic

This commit is contained in:
Hugo Falcao
2022-08-09 00:38:22 -03:00
parent d0cce0b3cc
commit ef1e3c578b
5 changed files with 210 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
import {MigrationInterface, QueryRunner, Table} from "typeorm";
export class CreateDestinations1660009323138 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.createTable(
new Table({
name: 'destinations',
columns: [
{
name: 'id_destination',
type: 'integer',
isPrimary: true,
isGenerated: true,
generationStrategy: 'increment',
},
{
name: 'route_id',
type: 'integer',
},
{
name: 'name',
type: 'varchar',
},
{
name: 'latitude',
type: 'numeric',
},
{
name: 'longitude',
type: 'numeric',
}
],
}),
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropTable('destinations');
}
}