refactor(migrations): ♻️ Atualiza migration de itineraries
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
import { MigrationInterface, QueryRunner, Table, TableForeignKey, TableIndex } from 'typeorm';
|
||||
import {
|
||||
MigrationInterface,
|
||||
QueryRunner,
|
||||
Table,
|
||||
TableForeignKey,
|
||||
TableIndex,
|
||||
} from 'typeorm';
|
||||
|
||||
export class CreateItineraries1659404395471 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
@@ -47,6 +53,22 @@ export class CreateItineraries1659404395471 implements MigrationInterface {
|
||||
name: 'itinerary_nickname',
|
||||
type: 'varchar',
|
||||
},
|
||||
{
|
||||
name: 'is_active',
|
||||
type: 'boolean',
|
||||
},
|
||||
{
|
||||
name: 'estimated_departure_address',
|
||||
type: 'varchar',
|
||||
},
|
||||
{
|
||||
name: 'departure_latitude',
|
||||
type: 'numeric',
|
||||
},
|
||||
{
|
||||
name: 'departure_longitude',
|
||||
type: 'numeric',
|
||||
},
|
||||
{
|
||||
name: 'created_at',
|
||||
type: 'timestamp',
|
||||
@@ -77,9 +99,14 @@ export class CreateItineraries1659404395471 implements MigrationInterface {
|
||||
'itineraries',
|
||||
new TableIndex({
|
||||
name: 'itineraries_idx',
|
||||
columnNames: ['van_plate', 'days_of_week', 'specific_day', 'estimated_departure_time'],
|
||||
columnNames: [
|
||||
'van_plate',
|
||||
'days_of_week',
|
||||
'specific_day',
|
||||
'estimated_departure_time',
|
||||
],
|
||||
isUnique: true,
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import { MigrationInterface, QueryRunner, Table, TableForeignKey, TableIndex } from 'typeorm';
|
||||
import {
|
||||
MigrationInterface,
|
||||
QueryRunner,
|
||||
Table,
|
||||
TableForeignKey,
|
||||
TableIndex,
|
||||
} from 'typeorm';
|
||||
|
||||
export class CreatePassengers1660010452826 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
@@ -21,6 +27,22 @@ export class CreatePassengers1660010452826 implements MigrationInterface {
|
||||
name: 'user_id',
|
||||
type: 'uuid',
|
||||
},
|
||||
{
|
||||
name: 'address',
|
||||
type: 'varchar',
|
||||
},
|
||||
{
|
||||
name: 'latitude_address',
|
||||
type: 'numeric',
|
||||
},
|
||||
{
|
||||
name: 'longitude_address',
|
||||
type: 'numeric',
|
||||
},
|
||||
{
|
||||
name: 'payment_status',
|
||||
type: 'boolean',
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
@@ -61,7 +83,10 @@ export class CreatePassengers1660010452826 implements MigrationInterface {
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.dropTable('passengers');
|
||||
await queryRunner.dropForeignKey('passengers', 'passengers_itinerary_id_fk');
|
||||
await queryRunner.dropForeignKey(
|
||||
'passengers',
|
||||
'passengers_itinerary_id_fk',
|
||||
);
|
||||
await queryRunner.dropForeignKey('passengers', 'passengers_user_id_fk');
|
||||
await queryRunner.dropIndex('passengers', 'passengers_itinerary_user_idx');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user