|
|
|
|
@@ -1,490 +0,0 @@
|
|
|
|
|
import { Migration } from "@mikro-orm/migrations";
|
|
|
|
|
|
|
|
|
|
export class Migration20251130032813 extends Migration {
|
|
|
|
|
override async up(): Promise<void> {
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create type "skytrax_type" as enum ('full_service', 'low_cost');`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(`create type "package_type" as enum ('reguler', 'plus');`);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create type "package_class" as enum ('silver', 'gold', 'platinum');`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create type "package_itinerary_widget_type" as enum ('hotel', 'information', 'transport');`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create type "verification_type" as enum ('admin:create', 'admin:changeEmail', 'admin:changePassword', 'admin:update', 'partner:create', 'partner:changeEmail', 'partner:changePassword', 'partner:update', 'order:create');`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create type "room_type" as enum ('double', 'triple', 'quad', 'infant');`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create type "admin_permission" as enum ('country:create', 'country:update', 'country:delete', 'city:create', 'city:update', 'city:delete', 'airline:create', 'airline:update', 'airline:delete', 'airport:create', 'airport:update', 'airport:delete', 'flight:create', 'flight:update', 'flight:delete', 'flight-class:create', 'flight-class:update', 'flight-class:delete', 'hotel-facility:create', 'hotel-facility:update', 'hotel-facility:delete', 'hotel:create', 'hotel:update', 'hotel:delete', 'transportation:create', 'transportation:update', 'transportation:delete', 'transportation-class:create', 'transportation-class:update', 'transportation-class:delete', 'package:create', 'package:update', 'package:delete', 'package-detail:create', 'package-detail:update', 'package-detail:delete', 'admin:create', 'admin:update', 'admin:delete', 'partner:create', 'partner:update', 'partner:delete');`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "airline" ("id" varchar(30) not null, "name" varchar(100) not null, "code" varchar(10) not null, "logo" varchar(100) not null, "skytrax_rating" int not null, "skytrax_type" "skytrax_type" not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "airline_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "airline" add constraint "airline_code_unique" unique ("code");`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "country" ("id" varchar(30) not null, "name" varchar(100) not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "country_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "city" ("id" varchar(30) not null, "name" varchar(100) not null, "country_id" varchar(30) not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "city_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "airport" ("id" varchar(30) not null, "name" varchar(100) not null, "code" varchar(10) not null, "city_id" varchar(30) not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "airport_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "airport" add constraint "airport_code_unique" unique ("code");`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "flight" ("id" varchar(30) not null, "airline_id" varchar(30) not null, "number" int not null, "departure_airport_id" varchar(30) not null, "departure_terminal" varchar(100) null, "departure_gate" varchar(100) null, "departure_time" time(0) not null, "arrival_airport_id" varchar(30) not null, "arrival_terminal" varchar(100) null, "arrival_gate" varchar(100) null, "duration" int not null, "aircraft" varchar(100) not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "flight_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "flight" add constraint "flight_airline_id_number_unique" unique ("airline_id", "number");`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "flight_class" ("id" varchar(30) not null, "flight_id" varchar(30) not null, "class" varchar(100) not null, "seat_layout" varchar(10) not null, "baggage" int not null, "cabin_baggage" int not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "flight_class_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "flight_class" add constraint "flight_class_flight_id_class_unique" unique ("flight_id", "class");`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "flight_schedule" ("id" varchar(30) not null, "flight_id" varchar(30) not null, "next_id" varchar(30) null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "flight_schedule_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "hotel" ("id" varchar(30) not null, "name" varchar(100) not null, "city_id" varchar(30) not null, "star" int not null, "google_maps_link" varchar(1000) not null, "google_maps_embed" varchar(1000) not null, "google_reviews_link" varchar(1000) not null, "description" varchar(1000) not null, "address" varchar(100) not null, "landmark" varchar(100) not null, "distance_to_landmark" numeric(10,0) not null, "food_type" varchar(100) not null, "food_amount" int not null, "food_menu" varchar(100) not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "hotel_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "hotel_facility" ("id" varchar(30) not null, "name" varchar(100) not null, "icon" varchar(100) not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "hotel_facility_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "hotel_facilities" ("hotel_id" varchar(30) not null, "hotel_facility_id" varchar(30) not null, constraint "hotel_facilities_pkey" primary key ("hotel_id", "hotel_facility_id"));`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "hotel_image" ("id" varchar(30) not null, "hotel_id" varchar(30) not null, "src" varchar(100) not null, "created_at" varchar(100) not null, "updated_at" timestamptz not null, constraint "hotel_image_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "package" ("id" varchar(30) not null, "name" varchar(100) not null, "type" "package_type" not null, "class" "package_class" not null, "thumbnail" varchar(100) not null, "use_fast_train" boolean not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "package_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "package_itinerary_day" ("id" varchar(30) not null, "title" varchar(100) not null, "description" varchar(1000) not null, "next_id" varchar(30) null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "package_itinerary_day_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "package_itinerary" ("id" varchar(30) not null, "location" varchar(100) not null, "day_id" varchar(30) null, "next_id" varchar(30) null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "package_itinerary_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "package_itinerary_image" ("id" varchar(30) not null, "package_itinerary_id" varchar(30) not null, "src" varchar(100) not null, "created_at" varchar(100) not null, "updated_at" timestamptz not null, constraint "package_itinerary_image_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "package_itinerary_widget" ("id" varchar(30) not null, "package_itinerary_day_id" varchar(30) not null, "type" "package_itinerary_widget_type" not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, "hotel_id" varchar(30) null, "description" varchar(1000) null, "transportation" varchar(100) null, "from" varchar(100) null, "to" varchar(100) null, constraint "package_itinerary_widget_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create index "package_itinerary_widget_type_index" on "package_itinerary_widget" ("type");`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "transportation" ("id" varchar(30) not null, "name" varchar(100) not null, "type" varchar(100) not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "transportation_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "transportation_class" ("id" varchar(30) not null, "transportation_id" varchar(30) not null, "class" varchar(100) not null, "total_seats" int not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "transportation_class_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "transportation_class" add constraint "transportation_class_transportation_id_class_unique" unique ("transportation_id", "class");`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "package_detail" ("id" varchar(30) not null, "package_id" varchar(30) not null, "departure_date" date not null, "tour_flight_id" varchar(30) null, "outbound_flight_id" varchar(30) null, "inbound_flight_id" varchar(30) null, "makkah_hotel_id" varchar(30) null, "madinah_hotel_id" varchar(30) null, "transportation_id" varchar(30) not null, "quad_price" numeric(10,0) not null, "triple_price" numeric(10,0) not null, "double_price" numeric(10,0) not null, "infant_price" numeric(10,0) null, "itinerary_id" varchar(30) null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "package_detail_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail" add constraint "package_detail_package_id_departure_date_unique" unique ("package_id", "departure_date");`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "package_detail_tour_hotels" ("package_detail_id" varchar(30) not null, "hotel_id" varchar(30) not null, constraint "package_detail_tour_hotels_pkey" primary key ("package_detail_id", "hotel_id"));`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "transportation_image" ("id" varchar(30) not null, "transportation_id" varchar(30) not null, "src" varchar(100) not null, "created_at" varchar(100) not null, "updated_at" timestamptz not null, constraint "transportation_image_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "verification" ("id" varchar(30) not null, "code" char(6) not null, "type" "verification_type" not null, "expired_at" timestamptz not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "verification_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "partner" ("id" varchar(30) not null, "name" varchar(100) not null, "email" varchar(254) not null, "whatsapp" varchar(20) not null, "password" text not null, "avatar" varchar(100) null, "verification_id" varchar(30) null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "partner_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "partner" add constraint "partner_email_unique" unique ("email");`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "partner" add constraint "partner_whatsapp_unique" unique ("whatsapp");`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "order" ("id" varchar(30) not null, "package_id" varchar(30) not null, "name" varchar(100) not null, "whatsapp" varchar(20) not null, "verification_id" varchar(30) null, "partner_id" varchar(30) null, "expired_at" timestamptz null, "purchased_at" timestamptz null, "finished_at" timestamptz null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "order_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "order_detail" ("id" varchar(30) not null, "order_id" varchar(30) not null, "room_type" "room_type" not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "order_detail_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`create table "admin" ("id" varchar(30) not null, "name" varchar(100) not null, "email" varchar(254) not null, "password" text not null, "avatar" varchar(100) null, "permissions" "admin_permission"[] not null, "verification_id" varchar(30) null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "admin_pkey" primary key ("id"));`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "admin" add constraint "admin_email_unique" unique ("email");`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "city" add constraint "city_country_id_foreign" foreign key ("country_id") references "country" ("id") on update cascade;`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "airport" add constraint "airport_city_id_foreign" foreign key ("city_id") references "city" ("id") on update cascade;`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "flight" add constraint "flight_airline_id_foreign" foreign key ("airline_id") references "airline" ("id") on update cascade;`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "flight" add constraint "flight_departure_airport_id_foreign" foreign key ("departure_airport_id") references "airport" ("id") on update cascade;`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "flight" add constraint "flight_arrival_airport_id_foreign" foreign key ("arrival_airport_id") references "airport" ("id") on update cascade;`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "flight_class" add constraint "flight_class_flight_id_foreign" foreign key ("flight_id") references "flight" ("id") on update cascade;`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "flight_schedule" add constraint "flight_schedule_flight_id_foreign" foreign key ("flight_id") references "flight_class" ("id") on update cascade;`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "flight_schedule" add constraint "flight_schedule_next_id_foreign" foreign key ("next_id") references "flight_schedule" ("id") on delete cascade;`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "hotel" add constraint "hotel_city_id_foreign" foreign key ("city_id") references "city" ("id") on update cascade;`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "hotel_facilities" add constraint "hotel_facilities_hotel_id_foreign" foreign key ("hotel_id") references "hotel" ("id") on update cascade on delete cascade;`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "hotel_facilities" add constraint "hotel_facilities_hotel_facility_id_foreign" foreign key ("hotel_facility_id") references "hotel_facility" ("id") on update cascade on delete cascade;`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "hotel_image" add constraint "hotel_image_hotel_id_foreign" foreign key ("hotel_id") references "hotel" ("id") on update cascade;`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_itinerary_day" add constraint "package_itinerary_day_next_id_foreign" foreign key ("next_id") references "package_itinerary_day" ("id") on delete cascade;`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_itinerary" add constraint "package_itinerary_day_id_foreign" foreign key ("day_id") references "package_itinerary_day" ("id") on delete cascade;`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_itinerary" add constraint "package_itinerary_next_id_foreign" foreign key ("next_id") references "package_itinerary" ("id") on delete cascade;`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_itinerary_image" add constraint "package_itinerary_image_package_itinerary_id_foreign" foreign key ("package_itinerary_id") references "package_itinerary" ("id") on update cascade;`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_itinerary_widget" add constraint "package_itinerary_widget_package_itinerary_day_id_foreign" foreign key ("package_itinerary_day_id") references "package_itinerary_day" ("id") on update cascade;`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_itinerary_widget" add constraint "package_itinerary_widget_hotel_id_foreign" foreign key ("hotel_id") references "hotel" ("id") on update cascade on delete set null;`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "transportation_class" add constraint "transportation_class_transportation_id_foreign" foreign key ("transportation_id") references "transportation" ("id") on update cascade;`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail" add constraint "package_detail_package_id_foreign" foreign key ("package_id") references "package" ("id") on update cascade;`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail" add constraint "package_detail_tour_flight_id_foreign" foreign key ("tour_flight_id") references "flight_schedule" ("id") on delete cascade;`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail" add constraint "package_detail_outbound_flight_id_foreign" foreign key ("outbound_flight_id") references "flight_schedule" ("id") on delete cascade;`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail" add constraint "package_detail_inbound_flight_id_foreign" foreign key ("inbound_flight_id") references "flight_schedule" ("id") on delete cascade;`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail" add constraint "package_detail_makkah_hotel_id_foreign" foreign key ("makkah_hotel_id") references "hotel" ("id") on delete cascade;`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail" add constraint "package_detail_madinah_hotel_id_foreign" foreign key ("madinah_hotel_id") references "hotel" ("id") on delete cascade;`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail" add constraint "package_detail_transportation_id_foreign" foreign key ("transportation_id") references "transportation_class" ("id") on update cascade;`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail" add constraint "package_detail_itinerary_id_foreign" foreign key ("itinerary_id") references "package_itinerary" ("id") on delete cascade;`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail_tour_hotels" add constraint "package_detail_tour_hotels_package_detail_id_foreign" foreign key ("package_detail_id") references "package_detail" ("id") on update cascade on delete cascade;`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail_tour_hotels" add constraint "package_detail_tour_hotels_hotel_id_foreign" foreign key ("hotel_id") references "hotel" ("id") on update cascade on delete cascade;`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "transportation_image" add constraint "transportation_image_transportation_id_foreign" foreign key ("transportation_id") references "transportation_class" ("id") on update cascade;`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "partner" add constraint "partner_verification_id_foreign" foreign key ("verification_id") references "verification" ("id") on update cascade on delete set null;`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "order" add constraint "order_package_id_foreign" foreign key ("package_id") references "package_detail" ("id") on update cascade;`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "order" add constraint "order_verification_id_foreign" foreign key ("verification_id") references "verification" ("id") on update cascade on delete set null;`,
|
|
|
|
|
);
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "order" add constraint "order_partner_id_foreign" foreign key ("partner_id") references "partner" ("id") on update cascade on delete set null;`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "order_detail" add constraint "order_detail_order_id_foreign" foreign key ("order_id") references "order" ("id") on update cascade;`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "admin" add constraint "admin_verification_id_foreign" foreign key ("verification_id") references "verification" ("id") on update cascade on delete set null;`,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override async down(): Promise<void> {
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "flight" drop constraint "flight_airline_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "city" drop constraint "city_country_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "airport" drop constraint "airport_city_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(`alter table "hotel" drop constraint "hotel_city_id_foreign";`);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "flight" drop constraint "flight_departure_airport_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "flight" drop constraint "flight_arrival_airport_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "flight_class" drop constraint "flight_class_flight_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "flight_schedule" drop constraint "flight_schedule_flight_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "flight_schedule" drop constraint "flight_schedule_next_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail" drop constraint "package_detail_tour_flight_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail" drop constraint "package_detail_outbound_flight_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail" drop constraint "package_detail_inbound_flight_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "hotel_facilities" drop constraint "hotel_facilities_hotel_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "hotel_image" drop constraint "hotel_image_hotel_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_itinerary_widget" drop constraint "package_itinerary_widget_hotel_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail" drop constraint "package_detail_makkah_hotel_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail" drop constraint "package_detail_madinah_hotel_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail_tour_hotels" drop constraint "package_detail_tour_hotels_hotel_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "hotel_facilities" drop constraint "hotel_facilities_hotel_facility_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail" drop constraint "package_detail_package_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_itinerary_day" drop constraint "package_itinerary_day_next_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_itinerary" drop constraint "package_itinerary_day_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_itinerary_widget" drop constraint "package_itinerary_widget_package_itinerary_day_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_itinerary" drop constraint "package_itinerary_next_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_itinerary_image" drop constraint "package_itinerary_image_package_itinerary_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail" drop constraint "package_detail_itinerary_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "transportation_class" drop constraint "transportation_class_transportation_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail" drop constraint "package_detail_transportation_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "transportation_image" drop constraint "transportation_image_transportation_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "package_detail_tour_hotels" drop constraint "package_detail_tour_hotels_package_detail_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "order" drop constraint "order_package_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "partner" drop constraint "partner_verification_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "order" drop constraint "order_verification_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "admin" drop constraint "admin_verification_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "order" drop constraint "order_partner_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(
|
|
|
|
|
`alter table "order_detail" drop constraint "order_detail_order_id_foreign";`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "airline" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "country" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "city" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "airport" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "flight" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "flight_class" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "flight_schedule" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "hotel" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "hotel_facility" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "hotel_facilities" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "hotel_image" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "package" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "package_itinerary_day" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "package_itinerary" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "package_itinerary_image" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "package_itinerary_widget" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "transportation" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "transportation_class" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "package_detail" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "package_detail_tour_hotels" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "transportation_image" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "verification" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "partner" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "order" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "order_detail" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop table if exists "admin" cascade;`);
|
|
|
|
|
|
|
|
|
|
this.addSql(`drop type "skytrax_type";`);
|
|
|
|
|
this.addSql(`drop type "package_type";`);
|
|
|
|
|
this.addSql(`drop type "package_class";`);
|
|
|
|
|
this.addSql(`drop type "package_itinerary_widget_type";`);
|
|
|
|
|
this.addSql(`drop type "verification_type";`);
|
|
|
|
|
this.addSql(`drop type "room_type";`);
|
|
|
|
|
this.addSql(`drop type "admin_permission";`);
|
|
|
|
|
}
|
|
|
|
|
}
|