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 {
|
export class CreateItineraries1659404395471 implements MigrationInterface {
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
@@ -47,6 +53,22 @@ export class CreateItineraries1659404395471 implements MigrationInterface {
|
|||||||
name: 'itinerary_nickname',
|
name: 'itinerary_nickname',
|
||||||
type: 'varchar',
|
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',
|
name: 'created_at',
|
||||||
type: 'timestamp',
|
type: 'timestamp',
|
||||||
@@ -77,9 +99,14 @@ export class CreateItineraries1659404395471 implements MigrationInterface {
|
|||||||
'itineraries',
|
'itineraries',
|
||||||
new TableIndex({
|
new TableIndex({
|
||||||
name: 'itineraries_idx',
|
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,
|
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 {
|
export class CreatePassengers1660010452826 implements MigrationInterface {
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
@@ -21,6 +27,22 @@ export class CreatePassengers1660010452826 implements MigrationInterface {
|
|||||||
name: 'user_id',
|
name: 'user_id',
|
||||||
type: 'uuid',
|
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> {
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
await queryRunner.dropTable('passengers');
|
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.dropForeignKey('passengers', 'passengers_user_id_fk');
|
||||||
await queryRunner.dropIndex('passengers', 'passengers_itinerary_user_idx');
|
await queryRunner.dropIndex('passengers', 'passengers_itinerary_user_idx');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user