-- CreateSchema
CREATE SCHEMA IF NOT EXISTS "act";

-- CreateSchema
CREATE SCHEMA IF NOT EXISTS "hst";

-- CreateSchema
CREATE SCHEMA IF NOT EXISTS "itn";

-- CreateSchema
CREATE SCHEMA IF NOT EXISTS "mst";

-- CreateSchema
CREATE SCHEMA IF NOT EXISTS "sch";

-- CreateSchema
CREATE SCHEMA IF NOT EXISTS "usr";

-- CreateTable
CREATE TABLE "usr"."users" (
    "id" SERIAL NOT NULL,
    "first_name" VARCHAR(50),
    "last_name" VARCHAR(50),
    "role_xid" INTEGER,
    "date_of_birth" TIMESTAMP(3),
    "email_address" VARCHAR(150) NOT NULL,
    "isd_code" VARCHAR(6),
    "mobile_number" VARCHAR(15),
    "user_password" VARCHAR(255),
    "user_passcode" VARCHAR(10),
    "profile_image" VARCHAR(500),
    "user_lat" VARCHAR(20),
    "user_long" VARCHAR(20),
    "user_status" VARCHAR(20) DEFAULT 'pending',
    "is_email_verified" BOOLEAN DEFAULT false,
    "is_mobile_verified" BOOLEAN DEFAULT false,
    "is_profile_updated" BOOLEAN DEFAULT false,
    "is_active" BOOLEAN DEFAULT true,
    "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3),
    "deleted_at" TIMESTAMP(3),
    "connectionsId" INTEGER,
    "energyLevelsId" INTEGER,
    "is_biometric" BOOLEAN DEFAULT false,

    CONSTRAINT "users_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "usr"."user_address_details" (
    "id" SERIAL NOT NULL,
    "user_xid" INTEGER NOT NULL,
    "address_1" VARCHAR(150) NOT NULL,
    "address_2" VARCHAR(150),
    "country_xid" INTEGER NOT NULL,
    "state_xid" INTEGER NOT NULL,
    "city_xid" INTEGER NOT NULL,
    "pin_code" VARCHAR(10) NOT NULL,
    "location_name" VARCHAR(100),
    "location_address" VARCHAR(200),
    "location_lat" DOUBLE PRECISION,
    "location_long" DOUBLE PRECISION,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "user_address_details_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "usr"."user_documents" (
    "id" SERIAL NOT NULL,
    "user_xid" INTEGER NOT NULL,
    "file_name" VARCHAR(500) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "user_documents_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "usr"."user_otps" (
    "id" SERIAL NOT NULL,
    "user_xid" INTEGER NOT NULL,
    "otp_type" VARCHAR(20) NOT NULL,
    "otp_code" VARCHAR(255) NOT NULL,
    "send_on" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "verified_on" TIMESTAMP(3),
    "expires_on" TIMESTAMP(3) NOT NULL,
    "is_verified" BOOLEAN NOT NULL DEFAULT false,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "user_otps_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "usr"."invite_details" (
    "id" SERIAL NOT NULL,
    "user_xid" INTEGER NOT NULL,
    "is_invited" BOOLEAN NOT NULL DEFAULT false,
    "invited_by" INTEGER NOT NULL,
    "invited_on" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "is_accepted" BOOLEAN NOT NULL DEFAULT false,
    "accepted_on" TIMESTAMP(3),
    "invitation_status" VARCHAR(20) NOT NULL DEFAULT 'invited',
    "is_minglar_invitation" BOOLEAN NOT NULL DEFAULT false,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "invite_details_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "usr"."user_revenue" (
    "id" SERIAL NOT NULL,
    "user_xid" INTEGER NOT NULL,
    "is_fixed_salary" BOOLEAN NOT NULL DEFAULT false,
    "per_value" DOUBLE PRECISION NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "user_revenue_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "usr"."connect_details" (
    "id" SERIAL NOT NULL,
    "user_xid" INTEGER NOT NULL,
    "connect_xid" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "connect_details_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "usr"."friends" (
    "id" SERIAL NOT NULL,
    "user_xid" INTEGER NOT NULL,
    "friend_xid" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "friends_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "usr"."user_interests" (
    "id" SERIAL NOT NULL,
    "user_xid" INTEGER NOT NULL,
    "interest_xid" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "user_interests_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."countries" (
    "id" SERIAL NOT NULL,
    "country_name" VARCHAR(50) NOT NULL,
    "country_code" VARCHAR(10) NOT NULL,
    "country_flag" TEXT NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "countries_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."currencies" (
    "id" SERIAL NOT NULL,
    "country_xid" INTEGER NOT NULL,
    "currency_name" VARCHAR(20) NOT NULL,
    "currency_symbol" VARCHAR(10) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "currencies_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."states" (
    "id" SERIAL NOT NULL,
    "country_xid" INTEGER NOT NULL,
    "state_name" VARCHAR(50) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "states_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."cities" (
    "id" SERIAL NOT NULL,
    "state_xid" INTEGER NOT NULL,
    "city_name" VARCHAR(50) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "cities_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."taxes" (
    "id" SERIAL NOT NULL,
    "country_xid" INTEGER NOT NULL,
    "tax_name" VARCHAR(100) NOT NULL,
    "tax_per" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "taxes_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."banks" (
    "id" SERIAL NOT NULL,
    "country_xid" INTEGER NOT NULL,
    "bank_name" VARCHAR(100) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "banks_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."bank_branches" (
    "id" SERIAL NOT NULL,
    "bank_xid" INTEGER NOT NULL,
    "state_xid" INTEGER NOT NULL,
    "city_xid" INTEGER NOT NULL,
    "branch_address" VARCHAR(150) NOT NULL,
    "ifsc_code" VARCHAR(30) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "bank_branches_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."interests" (
    "id" SERIAL NOT NULL,
    "interest_name" VARCHAR(50) NOT NULL,
    "display_order" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "interests_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."acitivity_types" (
    "id" SERIAL NOT NULL,
    "interest_xid" INTEGER NOT NULL,
    "activity_type_name" VARCHAR(30) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "acitivity_types_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."document_type" (
    "id" SERIAL NOT NULL,
    "document_type_name" VARCHAR(30) NOT NULL,
    "display_order" INTEGER,
    "is_visible" BOOLEAN NOT NULL DEFAULT true,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "document_type_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."food_cuisines" (
    "id" SERIAL NOT NULL,
    "cuisine_name" VARCHAR(30) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "food_cuisines_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."company_types" (
    "id" SERIAL NOT NULL,
    "company_type_name" VARCHAR(30) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "company_types_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."amenities" (
    "id" SERIAL NOT NULL,
    "amenities_name" VARCHAR(30) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "amenities_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."food_types" (
    "id" SERIAL NOT NULL,
    "food_type_name" VARCHAR(30) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "food_types_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."frequencies" (
    "id" SERIAL NOT NULL,
    "frequency_name" VARCHAR(30) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "frequencies_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."navigation_modes" (
    "id" SERIAL NOT NULL,
    "navigation_mode_name" VARCHAR(30) NOT NULL,
    "navigation_mode_icon" VARCHAR(500) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "navigation_modes_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."transport_modes" (
    "id" SERIAL NOT NULL,
    "transport_mode_name" VARCHAR(60) NOT NULL,
    "transport_mode_icon" VARCHAR(500) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "transport_modes_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."pqq_categories" (
    "id" SERIAL NOT NULL,
    "category_name" VARCHAR(100) NOT NULL,
    "display_order" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "pqq_categories_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."pqq_sub_categories" (
    "id" SERIAL NOT NULL,
    "category_xid" INTEGER NOT NULL,
    "sub_category_name" VARCHAR(100) NOT NULL,
    "display_order" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "pqq_sub_categories_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."pqq_questions" (
    "id" SERIAL NOT NULL,
    "pqq_sub_category_xid" INTEGER NOT NULL,
    "question_name" VARCHAR(500) NOT NULL,
    "max_points" INTEGER NOT NULL,
    "display_order" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "pqq_questions_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."pqq_answers" (
    "id" SERIAL NOT NULL,
    "pqq_question_xid" INTEGER NOT NULL,
    "answer_name" VARCHAR(500) NOT NULL,
    "answer_points" INTEGER NOT NULL,
    "display_order" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "pqq_answers_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."age_restrictions" (
    "id" SERIAL NOT NULL,
    "age_restriction_name" VARCHAR(30) NOT NULL,
    "min_age" INTEGER NOT NULL,
    "max_age" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "age_restrictions_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."allowed_entry_types" (
    "id" SERIAL NOT NULL,
    "allowed_entry_type_name" VARCHAR(30) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "allowed_entry_types_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."roles" (
    "id" SERIAL NOT NULL,
    "role_name" VARCHAR(30) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "roles_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."connections" (
    "id" SERIAL NOT NULL,
    "connection_type" VARCHAR(30) NOT NULL,
    "connection_name" VARCHAR(30) NOT NULL,
    "location_details" VARCHAR(100) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "connections_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "mst"."energy_levels" (
    "id" SERIAL NOT NULL,
    "energy_level_name" VARCHAR(30) NOT NULL,
    "energy_icon" VARCHAR(400) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "energy_levels_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "usr"."tokens" (
    "id" SERIAL NOT NULL,
    "user_xid" INTEGER NOT NULL,
    "token" VARCHAR(200) NOT NULL,
    "token_type" VARCHAR(30) NOT NULL,
    "expiring_at" TIMESTAMP(3) NOT NULL,
    "device_id" VARCHAR(30),
    "player_id" VARCHAR(30),
    "is_black_listed" BOOLEAN NOT NULL DEFAULT false,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "tokens_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hst"."host_header" (
    "id" SERIAL NOT NULL,
    "user_xid" INTEGER NOT NULL,
    "company_name" VARCHAR(100) NOT NULL,
    "host_ref_number" VARCHAR(30) NOT NULL,
    "address_1" VARCHAR(150) NOT NULL,
    "address_2" VARCHAR(150),
    "city_xid" INTEGER NOT NULL,
    "state_xid" INTEGER NOT NULL,
    "country_xid" INTEGER NOT NULL,
    "pin_code" VARCHAR(30) NOT NULL,
    "logo_path" VARCHAR(400),
    "is_subsidairy" BOOLEAN NOT NULL DEFAULT false,
    "registration_number" VARCHAR(30) NOT NULL,
    "pan_number" VARCHAR(30) NOT NULL,
    "gst_number" VARCHAR(30),
    "formation_date" TIMESTAMP(3) NOT NULL,
    "company_type" VARCHAR(30) NOT NULL,
    "website_url" VARCHAR(50),
    "instagram_url" VARCHAR(80),
    "facebook_url" VARCHAR(80),
    "linkedin_url" VARCHAR(80),
    "twitter_url" VARCHAR(80),
    "currency_xid" INTEGER NOT NULL,
    "stepper" INTEGER NOT NULL DEFAULT 1,
    "host_status_internal" VARCHAR(20) NOT NULL DEFAULT 'pending',
    "host_status_Display" VARCHAR(20) NOT NULL DEFAULT 'pending',
    "admin_status_internal" VARCHAR(20) NOT NULL DEFAULT 'pending',
    "admin_status_display" VARCHAR(20) NOT NULL DEFAULT 'pending',
    "am_status" VARCHAR(20) NOT NULL DEFAULT 'pending',
    "agreement_accepted" BOOLEAN NOT NULL DEFAULT false,
    "account_manager_xid" INTEGER,
    "is_approved" BOOLEAN NOT NULL DEFAULT false,
    "agreement_start_date" TIMESTAMP(3),
    "duration_number" INTEGER,
    "duration_frequency" VARCHAR(20),
    "is_commision_base" BOOLEAN NOT NULL DEFAULT false,
    "commision_per" DOUBLE PRECISION,
    "amount_per_booking" INTEGER,
    "payout_duration_num" INTEGER,
    "payout_duration_frequency" VARCHAR(20),
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "host_header_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hst"."host_bank_details" (
    "id" SERIAL NOT NULL,
    "host_xid" INTEGER NOT NULL,
    "bank_xid" INTEGER NOT NULL,
    "bank_branch_xid" INTEGER NOT NULL,
    "account_holder_name" VARCHAR(30) NOT NULL,
    "account_number" VARCHAR(30) NOT NULL,
    "ifsc_code" VARCHAR(30) NOT NULL,
    "currency_xid" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "host_bank_details_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hst"."host_documents" (
    "id" SERIAL NOT NULL,
    "host_xid" INTEGER NOT NULL,
    "document_type_xid" INTEGER NOT NULL,
    "document_name" VARCHAR(20) NOT NULL,
    "file_path" VARCHAR(400) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "host_documents_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hst"."host_suggestion" (
    "id" SERIAL NOT NULL,
    "host_xid" INTEGER NOT NULL,
    "title" VARCHAR(20) NOT NULL,
    "comments" VARCHAR(200) NOT NULL,
    "is_parent" BOOLEAN NOT NULL DEFAULT false,
    "is_reviewed" BOOLEAN NOT NULL DEFAULT false,
    "reviewed_by_xid" INTEGER,
    "review_on" TIMESTAMP(3),
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "host_suggestion_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hst"."host_parent" (
    "id" SERIAL NOT NULL,
    "host_xid" INTEGER NOT NULL,
    "company_name" VARCHAR(50) NOT NULL,
    "address_1" VARCHAR(150) NOT NULL,
    "address_2" VARCHAR(150),
    "city_xid" INTEGER NOT NULL,
    "state_xid" INTEGER NOT NULL,
    "country_xid" INTEGER NOT NULL,
    "pin_code" VARCHAR(30) NOT NULL,
    "logo_path" VARCHAR(400),
    "is_subsidairy" BOOLEAN NOT NULL DEFAULT false,
    "registration_number" VARCHAR(30) NOT NULL,
    "pan_number" VARCHAR(30) NOT NULL,
    "gst_number" VARCHAR(30),
    "formation_date" TIMESTAMP(3) NOT NULL,
    "company_type" VARCHAR(30) NOT NULL,
    "website_url" VARCHAR(80),
    "instagram_url" VARCHAR(80),
    "facebook_url" VARCHAR(80),
    "linkedin_url" VARCHAR(80),
    "twitter_url" VARCHAR(80),
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "host_parent_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hst"."host_parent_documents" (
    "id" SERIAL NOT NULL,
    "host_parent_xid" INTEGER NOT NULL,
    "document_type_xid" INTEGER NOT NULL,
    "document_name" VARCHAR(30) NOT NULL,
    "file_path" VARCHAR(400) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "host_parent_documents_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hst"."host_track" (
    "id" SERIAL NOT NULL,
    "host_xid" INTEGER NOT NULL,
    "track_status" VARCHAR(20) NOT NULL,
    "updated_by_xid" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "host_track_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activities" (
    "id" SERIAL NOT NULL,
    "host_xid" INTEGER NOT NULL,
    "activity_type_xid" INTEGER NOT NULL,
    "frequencies_xid" INTEGER,
    "activity_ref_number" VARCHAR(30),
    "activity_title" VARCHAR(30),
    "activity_description" VARCHAR(80),
    "check_in_lat" DOUBLE PRECISION,
    "check_in_long" DOUBLE PRECISION,
    "check_in_address" VARCHAR(150),
    "is_check_out_same" BOOLEAN DEFAULT true,
    "check_out_lat" DOUBLE PRECISION,
    "check_out_long" DOUBLE PRECISION,
    "check_out_address" VARCHAR(150),
    "energy_level_xid" INTEGER,
    "activity_duration_mins" INTEGER,
    "food_available" BOOLEAN DEFAULT false,
    "food_is_chargeable" BOOLEAN DEFAULT false,
    "alcohol_available" BOOLEAN DEFAULT false,
    "trainer_available" BOOLEAN DEFAULT false,
    "trainer_is_chargeable" BOOLEAN DEFAULT false,
    "pick_up_drop_available" BOOLEAN DEFAULT false,
    "pick_up_drop_is_chargeable" BOOLEAN DEFAULT false,
    "in_activity_available" BOOLEAN DEFAULT false,
    "in_activity_is_chargeable" BOOLEAN DEFAULT false,
    "equipment_available" BOOLEAN DEFAULT false,
    "equipment_is_chargeable" BOOLEAN DEFAULT false,
    "cancellation_available" BOOLEAN DEFAULT false,
    "cancellation_allowed_before_mins" INTEGER,
    "currency_xid" INTEGER,
    "sustainability_score" INTEGER,
    "safety_score" INTEGER,
    "total_score" INTEGER,
    "is_instant_booking" BOOLEAN DEFAULT false,
    "activity_internal_status" VARCHAR(30) DEFAULT 'pending',
    "activity_display_status" VARCHAR(30) DEFAULT 'pending',
    "am_internal_status" VARCHAR(30) DEFAULT 'pending',
    "am_display_status" VARCHAR(30) DEFAULT 'pending',
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activities_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_other_details" (
    "id" SERIAL NOT NULL,
    "activity_xid" INTEGER NOT NULL,
    "food_cuisines" VARCHAR(30),
    "exclusive_notes" VARCHAR(50),
    "dos_notes" VARCHAR(200),
    "donts_notes" VARCHAR(200),
    "tips_notes" VARCHAR(100),
    "terms_and_condition" VARCHAR(500),
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_other_details_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activities_media" (
    "id" SERIAL NOT NULL,
    "activity_xid" INTEGER NOT NULL,
    "media_type" VARCHAR(30) NOT NULL,
    "media_file_name" VARCHAR(400) NOT NULL,
    "display_order" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activities_media_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_venues" (
    "id" SERIAL NOT NULL,
    "activity_xid" INTEGER NOT NULL,
    "venue_name" VARCHAR(50) NOT NULL,
    "venue_capacity" INTEGER NOT NULL,
    "available_seats" INTEGER NOT NULL,
    "is_min_people_req_mandatory" BOOLEAN NOT NULL DEFAULT false,
    "min_people_required" INTEGER,
    "min_req_fullfilled_before_mins" INTEGER,
    "venue_description" VARCHAR(200),
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_venues_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_trainers" (
    "id" SERIAL NOT NULL,
    "activity_xid" INTEGER NOT NULL,
    "base_amount" INTEGER NOT NULL,
    "total_amount" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_trainers_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_trainer_taxes" (
    "id" SERIAL NOT NULL,
    "activity_trainer_xid" INTEGER NOT NULL,
    "tax_xid" INTEGER NOT NULL,
    "tax_per" DOUBLE PRECISION NOT NULL,
    "tax_amount" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_trainer_taxes_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_eligibility" (
    "id" SERIAL NOT NULL,
    "activity_xid" INTEGER NOT NULL,
    "is_age_restriction" BOOLEAN NOT NULL DEFAULT false,
    "age_restriction_xid" INTEGER,
    "is_weight_restriction" BOOLEAN NOT NULL DEFAULT false,
    "weight_restriction_name" VARCHAR(30),
    "weight_entered" INTEGER,
    "weight_in" VARCHAR(30),
    "is_height_restriction" BOOLEAN NOT NULL DEFAULT false,
    "height_restriction_name" VARCHAR(30),
    "height_entered" INTEGER,
    "height_in" VARCHAR(30),
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_eligibility_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_suggestions" (
    "id" SERIAL NOT NULL,
    "activity_xid" INTEGER NOT NULL,
    "title" VARCHAR(30) NOT NULL,
    "comments" VARCHAR(200) NOT NULL,
    "is_reviewed" BOOLEAN NOT NULL DEFAULT false,
    "reviewed_by_xid" INTEGER NOT NULL,
    "reviewed_on" TIMESTAMP(3),
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_suggestions_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_am_details" (
    "id" SERIAL NOT NULL,
    "activity_xid" INTEGER NOT NULL,
    "account_manager_xid" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_am_details_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_prices" (
    "id" SERIAL NOT NULL,
    "activity_venue_xid" INTEGER NOT NULL,
    "no_of_session" INTEGER NOT NULL,
    "is_package" BOOLEAN NOT NULL DEFAULT false,
    "session_validity" INTEGER NOT NULL,
    "session_validity_frequency" TEXT NOT NULL,
    "base_price" INTEGER NOT NULL,
    "sell_price" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_prices_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_price_taxes" (
    "id" SERIAL NOT NULL,
    "activity_price_xid" INTEGER NOT NULL,
    "tax_xid" INTEGER NOT NULL,
    "tax_per" DOUBLE PRECISION NOT NULL,
    "tax_amount" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_price_taxes_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_venue_artifacts" (
    "id" SERIAL NOT NULL,
    "activity_venue_xid" INTEGER NOT NULL,
    "media_type" VARCHAR(30) NOT NULL,
    "media_file_name" VARCHAR(400) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_venue_artifacts_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_pqq_header" (
    "id" SERIAL NOT NULL,
    "activity_xid" INTEGER NOT NULL,
    "pqq_question_xid" INTEGER NOT NULL,
    "pqq_answer_xid" INTEGER NOT NULL,
    "comments" VARCHAR(200),
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_pqq_header_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_pqq_suggestions" (
    "id" SERIAL NOT NULL,
    "activity_pqq_header_xid" INTEGER NOT NULL,
    "title" VARCHAR(30) NOT NULL,
    "comments" VARCHAR(200) NOT NULL,
    "is_reviewed" BOOLEAN NOT NULL DEFAULT false,
    "reviewed_by_xid" INTEGER NOT NULL,
    "reviewed_on" TIMESTAMP(3),
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_pqq_suggestions_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_pqq_supportings" (
    "id" SERIAL NOT NULL,
    "activity_pqq_header_xid" INTEGER NOT NULL,
    "media_type" VARCHAR(30) NOT NULL,
    "media_file_name" VARCHAR(400) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_pqq_supportings_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_allowed_entry" (
    "id" SERIAL NOT NULL,
    "activity_xid" INTEGER NOT NULL,
    "allowed_entry_type_xid" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_allowed_entry_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_food_details" (
    "id" SERIAL NOT NULL,
    "activity_xid" INTEGER NOT NULL,
    "food_type_xid" INTEGER NOT NULL,
    "base_amount" INTEGER NOT NULL,
    "total_amount" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_food_details_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_food_taxes" (
    "id" SERIAL NOT NULL,
    "activity_food_details_xid" INTEGER NOT NULL,
    "tax_xid" INTEGER NOT NULL,
    "tax_per" DOUBLE PRECISION NOT NULL,
    "tax_amount" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_food_taxes_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_equipments" (
    "id" SERIAL NOT NULL,
    "activity_xid" INTEGER NOT NULL,
    "equipment_name" VARCHAR(30) NOT NULL,
    "is_equipment_chargeable" BOOLEAN NOT NULL DEFAULT false,
    "equipment_base_price" INTEGER NOT NULL,
    "equipment_total_price" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_equipments_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_equipment_taxes" (
    "id" SERIAL NOT NULL,
    "activity_equipment_xid" INTEGER NOT NULL,
    "tax_xid" INTEGER NOT NULL,
    "tax_per" DOUBLE PRECISION NOT NULL,
    "tax_amount" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_equipment_taxes_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_navigation_modes" (
    "id" SERIAL NOT NULL,
    "activity_xid" INTEGER NOT NULL,
    "navigation_mode_xid" INTEGER NOT NULL,
    "is_in_activity_chargeable" BOOLEAN NOT NULL DEFAULT false,
    "navigation_modes_base_price" INTEGER NOT NULL,
    "navigation_modes_total_price" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_navigation_modes_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_navigation_modes_taxes" (
    "id" SERIAL NOT NULL,
    "activity_navigation_mode_xid" INTEGER NOT NULL,
    "tax_xid" INTEGER NOT NULL,
    "tax_per" DOUBLE PRECISION NOT NULL,
    "tax_amount" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_navigation_modes_taxes_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_pick_up_details" (
    "id" SERIAL NOT NULL,
    "activity_xid" INTEGER NOT NULL,
    "is_pick_up" BOOLEAN NOT NULL DEFAULT false,
    "location_lat" DOUBLE PRECISION,
    "location_long" DOUBLE PRECISION,
    "location_address" VARCHAR(150),
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_pick_up_details_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_pick_up_transport" (
    "id" SERIAL NOT NULL,
    "activity_pick_up_details_xid" INTEGER NOT NULL,
    "transport_mode_xid" INTEGER NOT NULL,
    "is_transport_mode_chargeable" BOOLEAN NOT NULL DEFAULT false,
    "transport_base_price" INTEGER NOT NULL,
    "transport_total_price" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_pick_up_transport_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_pick_up_transport_taxes" (
    "id" SERIAL NOT NULL,
    "activity_pick_up_transport_xid" INTEGER NOT NULL,
    "tax_xid" INTEGER NOT NULL,
    "tax_per" DOUBLE PRECISION NOT NULL,
    "tax_amount" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_pick_up_transport_taxes_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_amenities" (
    "id" SERIAL NOT NULL,
    "activity_xid" INTEGER NOT NULL,
    "amenities_xid" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_amenities_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "sch"."schedule_header" (
    "id" SERIAL NOT NULL,
    "activity_xid" INTEGER NOT NULL,
    "activity_venue_xid" INTEGER NOT NULL,
    "schedule_type" VARCHAR(30) NOT NULL,
    "start_date" TIMESTAMP(3) NOT NULL,
    "end_date" TIMESTAMP(3) NOT NULL,
    "by_weekday" BOOLEAN NOT NULL DEFAULT false,
    "early_check_in_mins" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "schedule_header_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "sch"."schedule_details" (
    "id" SERIAL NOT NULL,
    "schedule_header_xid" INTEGER NOT NULL,
    "start_time" VARCHAR(30) NOT NULL,
    "end_time" VARCHAR(30) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "schedule_details_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."cancellations" (
    "id" SERIAL NOT NULL,
    "schedule_header_xid" INTEGER NOT NULL,
    "occurence_date" TIMESTAMP(3) NOT NULL,
    "start_time" VARCHAR(30) NOT NULL,
    "end_time" VARCHAR(30) NOT NULL,
    "cancellation_reason" TEXT NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "cancellations_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "itn"."itinerary_header" (
    "id" SERIAL NOT NULL,
    "itinerary_no" VARCHAR(30) NOT NULL,
    "title" VARCHAR(30) NOT NULL,
    "owner_xid" INTEGER NOT NULL,
    "from_date" TIMESTAMP(3) NOT NULL,
    "from_time" VARCHAR(30) NOT NULL,
    "to_date" TIMESTAMP(3) NOT NULL,
    "to_time" VARCHAR(30) NOT NULL,
    "itinerary_status" VARCHAR(30) NOT NULL DEFAULT 'draft',
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "itinerary_header_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "itn"."itinerary_members" (
    "id" SERIAL NOT NULL,
    "itinerary_header_xid" INTEGER NOT NULL,
    "member_xid" INTEGER NOT NULL,
    "member_role" VARCHAR(30) NOT NULL,
    "member_status" VARCHAR(30) NOT NULL DEFAULT 'pending',
    "invited_by_xid" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),
    "userId" INTEGER,

    CONSTRAINT "itinerary_members_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "itn"."itinerary_start_stop_details" (
    "id" SERIAL NOT NULL,
    "itinerary_header_xid" INTEGER NOT NULL,
    "itinerary_member_xid" INTEGER NOT NULL,
    "date_value" TIMESTAMP(3) NOT NULL,
    "time_value" VARCHAR(30) NOT NULL,
    "is_start_point" BOOLEAN NOT NULL,
    "location_lat" DOUBLE PRECISION,
    "location_long" DOUBLE PRECISION,
    "location_address" JSONB,
    "travel_mode" VARCHAR(30),
    "km_for_next_point" DOUBLE PRECISION,
    "time_for_next_point_mins" INTEGER,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "itinerary_start_stop_details_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "itn"."itinerary_activities" (
    "id" SERIAL NOT NULL,
    "itinerary_header_xid" INTEGER NOT NULL,
    "itinerary_type" VARCHAR(30) NOT NULL,
    "activity_xid" INTEGER NOT NULL,
    "scheduled_header_xid" INTEGER NOT NULL,
    "occurence_date" TIMESTAMP(3) NOT NULL,
    "start_time" VARCHAR(30) NOT NULL,
    "end_time" VARCHAR(30) NOT NULL,
    "end_date" TIMESTAMP(3) NOT NULL,
    "venue_xid" INTEGER NOT NULL,
    "location_lat" DOUBLE PRECISION,
    "location_long" DOUBLE PRECISION,
    "location_address" JSONB,
    "travel_mode" VARCHAR(30),
    "km_for_next_point" DOUBLE PRECISION,
    "time_for_next_point_mins" INTEGER,
    "pax_count" INTEGER NOT NULL,
    "total_amount" INTEGER NOT NULL,
    "booking_status" VARCHAR(30) NOT NULL DEFAULT 'pending',
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "itinerary_activities_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_sos_details" (
    "id" SERIAL NOT NULL,
    "itinerary_activity_xid" INTEGER NOT NULL,
    "updated_by_xid" INTEGER NOT NULL,
    "updated_on" TIMESTAMP(3) NOT NULL,
    "sos_status" VARCHAR(30) NOT NULL,
    "sos_lat" DOUBLE PRECISION NOT NULL,
    "sos_long" DOUBLE PRECISION NOT NULL,
    "comments" VARCHAR(200),
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_sos_details_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "act"."activity_feedbacks" (
    "id" SERIAL NOT NULL,
    "itinerary_activity_xid" INTEGER NOT NULL,
    "member_xid" INTEGER NOT NULL,
    "activity_stars" INTEGER NOT NULL,
    "comments" VARCHAR(200),
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "activity_feedbacks_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "itn"."itinerary_details" (
    "id" SERIAL NOT NULL,
    "itinerary_activity_xid" INTEGER NOT NULL,
    "itinerary_member_xid" INTEGER NOT NULL,
    "has_opted" BOOLEAN NOT NULL DEFAULT false,
    "updated_on" TIMESTAMP(3) NOT NULL,
    "itinerary_kind" VARCHAR(30) NOT NULL,
    "description_1" VARCHAR(100),
    "description_2" VARCHAR(80),
    "offline_code" VARCHAR(30),
    "activity_status" VARCHAR(30) NOT NULL,
    "is_chargeable" BOOLEAN NOT NULL DEFAULT false,
    "base_amount" INTEGER NOT NULL,
    "total_amount" INTEGER NOT NULL,
    "itinerary_status" VARCHAR(30) NOT NULL,
    "is_paid" BOOLEAN NOT NULL DEFAULT false,
    "paid_by_xid" INTEGER,
    "paid_on" TIMESTAMP(3),
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "itinerary_details_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "itn"."itinerary_detail_taxes" (
    "id" SERIAL NOT NULL,
    "itinerary_detail_xid" INTEGER NOT NULL,
    "tax_xid" INTEGER NOT NULL,
    "tax_per" DOUBLE PRECISION NOT NULL,
    "tax_amount" INTEGER NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "itinerary_detail_taxes_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "users_email_address_key" ON "usr"."users"("email_address");

-- CreateIndex
CREATE UNIQUE INDEX "countries_country_name_key" ON "mst"."countries"("country_name");

-- CreateIndex
CREATE UNIQUE INDEX "countries_country_code_key" ON "mst"."countries"("country_code");

-- CreateIndex
CREATE UNIQUE INDEX "currencies_currency_name_key" ON "mst"."currencies"("currency_name");

-- CreateIndex
CREATE UNIQUE INDEX "currencies_currency_symbol_key" ON "mst"."currencies"("currency_symbol");

-- CreateIndex
CREATE UNIQUE INDEX "states_state_name_key" ON "mst"."states"("state_name");

-- CreateIndex
CREATE UNIQUE INDEX "cities_city_name_key" ON "mst"."cities"("city_name");

-- CreateIndex
CREATE UNIQUE INDEX "taxes_tax_name_key" ON "mst"."taxes"("tax_name");

-- CreateIndex
CREATE UNIQUE INDEX "banks_bank_name_key" ON "mst"."banks"("bank_name");

-- CreateIndex
CREATE UNIQUE INDEX "bank_branches_branch_address_key" ON "mst"."bank_branches"("branch_address");

-- CreateIndex
CREATE UNIQUE INDEX "bank_branches_ifsc_code_key" ON "mst"."bank_branches"("ifsc_code");

-- CreateIndex
CREATE UNIQUE INDEX "interests_interest_name_key" ON "mst"."interests"("interest_name");

-- CreateIndex
CREATE UNIQUE INDEX "acitivity_types_activity_type_name_key" ON "mst"."acitivity_types"("activity_type_name");

-- CreateIndex
CREATE UNIQUE INDEX "document_type_document_type_name_key" ON "mst"."document_type"("document_type_name");

-- CreateIndex
CREATE UNIQUE INDEX "food_cuisines_cuisine_name_key" ON "mst"."food_cuisines"("cuisine_name");

-- CreateIndex
CREATE UNIQUE INDEX "company_types_company_type_name_key" ON "mst"."company_types"("company_type_name");

-- CreateIndex
CREATE UNIQUE INDEX "amenities_amenities_name_key" ON "mst"."amenities"("amenities_name");

-- CreateIndex
CREATE UNIQUE INDEX "food_types_food_type_name_key" ON "mst"."food_types"("food_type_name");

-- CreateIndex
CREATE UNIQUE INDEX "frequencies_frequency_name_key" ON "mst"."frequencies"("frequency_name");

-- CreateIndex
CREATE UNIQUE INDEX "navigation_modes_navigation_mode_name_key" ON "mst"."navigation_modes"("navigation_mode_name");

-- CreateIndex
CREATE UNIQUE INDEX "transport_modes_transport_mode_name_key" ON "mst"."transport_modes"("transport_mode_name");

-- CreateIndex
CREATE UNIQUE INDEX "pqq_categories_category_name_key" ON "mst"."pqq_categories"("category_name");

-- CreateIndex
CREATE UNIQUE INDEX "age_restrictions_age_restriction_name_key" ON "mst"."age_restrictions"("age_restriction_name");

-- CreateIndex
CREATE UNIQUE INDEX "allowed_entry_types_allowed_entry_type_name_key" ON "mst"."allowed_entry_types"("allowed_entry_type_name");

-- CreateIndex
CREATE UNIQUE INDEX "roles_role_name_key" ON "mst"."roles"("role_name");

-- CreateIndex
CREATE UNIQUE INDEX "connections_connection_type_key" ON "mst"."connections"("connection_type");

-- CreateIndex
CREATE UNIQUE INDEX "tokens_token_key" ON "usr"."tokens"("token");

-- CreateIndex
CREATE UNIQUE INDEX "host_bank_details_account_number_key" ON "hst"."host_bank_details"("account_number");

-- AddForeignKey
ALTER TABLE "usr"."users" ADD CONSTRAINT "users_role_xid_fkey" FOREIGN KEY ("role_xid") REFERENCES "mst"."roles"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "usr"."users" ADD CONSTRAINT "users_connectionsId_fkey" FOREIGN KEY ("connectionsId") REFERENCES "mst"."connections"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "usr"."users" ADD CONSTRAINT "users_energyLevelsId_fkey" FOREIGN KEY ("energyLevelsId") REFERENCES "mst"."energy_levels"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "usr"."user_address_details" ADD CONSTRAINT "user_address_details_user_xid_fkey" FOREIGN KEY ("user_xid") REFERENCES "usr"."users"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "usr"."user_address_details" ADD CONSTRAINT "user_address_details_country_xid_fkey" FOREIGN KEY ("country_xid") REFERENCES "mst"."countries"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "usr"."user_address_details" ADD CONSTRAINT "user_address_details_state_xid_fkey" FOREIGN KEY ("state_xid") REFERENCES "mst"."states"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "usr"."user_address_details" ADD CONSTRAINT "user_address_details_city_xid_fkey" FOREIGN KEY ("city_xid") REFERENCES "mst"."cities"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "usr"."user_documents" ADD CONSTRAINT "user_documents_user_xid_fkey" FOREIGN KEY ("user_xid") REFERENCES "usr"."users"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "usr"."user_otps" ADD CONSTRAINT "user_otps_user_xid_fkey" FOREIGN KEY ("user_xid") REFERENCES "usr"."users"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "usr"."invite_details" ADD CONSTRAINT "invite_details_user_xid_fkey" FOREIGN KEY ("user_xid") REFERENCES "usr"."users"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "usr"."invite_details" ADD CONSTRAINT "invite_details_invited_by_fkey" FOREIGN KEY ("invited_by") REFERENCES "usr"."users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "usr"."user_revenue" ADD CONSTRAINT "user_revenue_user_xid_fkey" FOREIGN KEY ("user_xid") REFERENCES "usr"."users"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "usr"."connect_details" ADD CONSTRAINT "connect_details_user_xid_fkey" FOREIGN KEY ("user_xid") REFERENCES "usr"."users"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "usr"."connect_details" ADD CONSTRAINT "connect_details_connect_xid_fkey" FOREIGN KEY ("connect_xid") REFERENCES "mst"."connections"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "usr"."friends" ADD CONSTRAINT "friends_user_xid_fkey" FOREIGN KEY ("user_xid") REFERENCES "usr"."users"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "usr"."friends" ADD CONSTRAINT "friends_friend_xid_fkey" FOREIGN KEY ("friend_xid") REFERENCES "usr"."users"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "usr"."user_interests" ADD CONSTRAINT "user_interests_user_xid_fkey" FOREIGN KEY ("user_xid") REFERENCES "usr"."users"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "usr"."user_interests" ADD CONSTRAINT "user_interests_interest_xid_fkey" FOREIGN KEY ("interest_xid") REFERENCES "mst"."interests"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "mst"."currencies" ADD CONSTRAINT "currencies_country_xid_fkey" FOREIGN KEY ("country_xid") REFERENCES "mst"."countries"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "mst"."states" ADD CONSTRAINT "states_country_xid_fkey" FOREIGN KEY ("country_xid") REFERENCES "mst"."countries"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "mst"."cities" ADD CONSTRAINT "cities_state_xid_fkey" FOREIGN KEY ("state_xid") REFERENCES "mst"."states"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "mst"."taxes" ADD CONSTRAINT "taxes_country_xid_fkey" FOREIGN KEY ("country_xid") REFERENCES "mst"."countries"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "mst"."banks" ADD CONSTRAINT "banks_country_xid_fkey" FOREIGN KEY ("country_xid") REFERENCES "mst"."countries"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "mst"."bank_branches" ADD CONSTRAINT "bank_branches_bank_xid_fkey" FOREIGN KEY ("bank_xid") REFERENCES "mst"."banks"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "mst"."bank_branches" ADD CONSTRAINT "bank_branches_state_xid_fkey" FOREIGN KEY ("state_xid") REFERENCES "mst"."states"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "mst"."bank_branches" ADD CONSTRAINT "bank_branches_city_xid_fkey" FOREIGN KEY ("city_xid") REFERENCES "mst"."cities"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "mst"."acitivity_types" ADD CONSTRAINT "acitivity_types_interest_xid_fkey" FOREIGN KEY ("interest_xid") REFERENCES "mst"."interests"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "mst"."pqq_sub_categories" ADD CONSTRAINT "pqq_sub_categories_category_xid_fkey" FOREIGN KEY ("category_xid") REFERENCES "mst"."pqq_categories"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "mst"."pqq_questions" ADD CONSTRAINT "pqq_questions_pqq_sub_category_xid_fkey" FOREIGN KEY ("pqq_sub_category_xid") REFERENCES "mst"."pqq_sub_categories"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "mst"."pqq_answers" ADD CONSTRAINT "pqq_answers_pqq_question_xid_fkey" FOREIGN KEY ("pqq_question_xid") REFERENCES "mst"."pqq_questions"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "usr"."tokens" ADD CONSTRAINT "tokens_user_xid_fkey" FOREIGN KEY ("user_xid") REFERENCES "usr"."users"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_header" ADD CONSTRAINT "host_header_user_xid_fkey" FOREIGN KEY ("user_xid") REFERENCES "usr"."users"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_header" ADD CONSTRAINT "host_header_city_xid_fkey" FOREIGN KEY ("city_xid") REFERENCES "mst"."cities"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_header" ADD CONSTRAINT "host_header_state_xid_fkey" FOREIGN KEY ("state_xid") REFERENCES "mst"."states"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_header" ADD CONSTRAINT "host_header_country_xid_fkey" FOREIGN KEY ("country_xid") REFERENCES "mst"."countries"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_header" ADD CONSTRAINT "host_header_currency_xid_fkey" FOREIGN KEY ("currency_xid") REFERENCES "mst"."currencies"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_header" ADD CONSTRAINT "host_header_account_manager_xid_fkey" FOREIGN KEY ("account_manager_xid") REFERENCES "usr"."users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_bank_details" ADD CONSTRAINT "host_bank_details_host_xid_fkey" FOREIGN KEY ("host_xid") REFERENCES "hst"."host_header"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_bank_details" ADD CONSTRAINT "host_bank_details_bank_xid_fkey" FOREIGN KEY ("bank_xid") REFERENCES "mst"."banks"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_bank_details" ADD CONSTRAINT "host_bank_details_bank_branch_xid_fkey" FOREIGN KEY ("bank_branch_xid") REFERENCES "mst"."bank_branches"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_bank_details" ADD CONSTRAINT "host_bank_details_currency_xid_fkey" FOREIGN KEY ("currency_xid") REFERENCES "mst"."currencies"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_documents" ADD CONSTRAINT "host_documents_host_xid_fkey" FOREIGN KEY ("host_xid") REFERENCES "hst"."host_header"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_documents" ADD CONSTRAINT "host_documents_document_type_xid_fkey" FOREIGN KEY ("document_type_xid") REFERENCES "mst"."document_type"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_suggestion" ADD CONSTRAINT "host_suggestion_host_xid_fkey" FOREIGN KEY ("host_xid") REFERENCES "hst"."host_header"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_suggestion" ADD CONSTRAINT "host_suggestion_reviewed_by_xid_fkey" FOREIGN KEY ("reviewed_by_xid") REFERENCES "usr"."users"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_parent" ADD CONSTRAINT "host_parent_host_xid_fkey" FOREIGN KEY ("host_xid") REFERENCES "hst"."host_header"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_parent" ADD CONSTRAINT "host_parent_city_xid_fkey" FOREIGN KEY ("city_xid") REFERENCES "mst"."cities"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_parent" ADD CONSTRAINT "host_parent_state_xid_fkey" FOREIGN KEY ("state_xid") REFERENCES "mst"."states"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_parent" ADD CONSTRAINT "host_parent_country_xid_fkey" FOREIGN KEY ("country_xid") REFERENCES "mst"."countries"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_parent_documents" ADD CONSTRAINT "host_parent_documents_host_parent_xid_fkey" FOREIGN KEY ("host_parent_xid") REFERENCES "hst"."host_parent"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_parent_documents" ADD CONSTRAINT "host_parent_documents_document_type_xid_fkey" FOREIGN KEY ("document_type_xid") REFERENCES "mst"."document_type"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_track" ADD CONSTRAINT "host_track_host_xid_fkey" FOREIGN KEY ("host_xid") REFERENCES "hst"."host_header"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hst"."host_track" ADD CONSTRAINT "host_track_updated_by_xid_fkey" FOREIGN KEY ("updated_by_xid") REFERENCES "usr"."users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activities" ADD CONSTRAINT "activities_host_xid_fkey" FOREIGN KEY ("host_xid") REFERENCES "hst"."host_header"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activities" ADD CONSTRAINT "activities_activity_type_xid_fkey" FOREIGN KEY ("activity_type_xid") REFERENCES "mst"."acitivity_types"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activities" ADD CONSTRAINT "activities_frequencies_xid_fkey" FOREIGN KEY ("frequencies_xid") REFERENCES "mst"."frequencies"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activities" ADD CONSTRAINT "activities_energy_level_xid_fkey" FOREIGN KEY ("energy_level_xid") REFERENCES "mst"."energy_levels"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activities" ADD CONSTRAINT "activities_currency_xid_fkey" FOREIGN KEY ("currency_xid") REFERENCES "mst"."currencies"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_other_details" ADD CONSTRAINT "activity_other_details_activity_xid_fkey" FOREIGN KEY ("activity_xid") REFERENCES "act"."activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activities_media" ADD CONSTRAINT "activities_media_activity_xid_fkey" FOREIGN KEY ("activity_xid") REFERENCES "act"."activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_venues" ADD CONSTRAINT "activity_venues_activity_xid_fkey" FOREIGN KEY ("activity_xid") REFERENCES "act"."activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_trainers" ADD CONSTRAINT "activity_trainers_activity_xid_fkey" FOREIGN KEY ("activity_xid") REFERENCES "act"."activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_trainer_taxes" ADD CONSTRAINT "activity_trainer_taxes_activity_trainer_xid_fkey" FOREIGN KEY ("activity_trainer_xid") REFERENCES "act"."activity_trainers"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_trainer_taxes" ADD CONSTRAINT "activity_trainer_taxes_tax_xid_fkey" FOREIGN KEY ("tax_xid") REFERENCES "mst"."taxes"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_eligibility" ADD CONSTRAINT "activity_eligibility_activity_xid_fkey" FOREIGN KEY ("activity_xid") REFERENCES "act"."activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_eligibility" ADD CONSTRAINT "activity_eligibility_age_restriction_xid_fkey" FOREIGN KEY ("age_restriction_xid") REFERENCES "mst"."age_restrictions"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_suggestions" ADD CONSTRAINT "activity_suggestions_activity_xid_fkey" FOREIGN KEY ("activity_xid") REFERENCES "act"."activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_suggestions" ADD CONSTRAINT "activity_suggestions_reviewed_by_xid_fkey" FOREIGN KEY ("reviewed_by_xid") REFERENCES "usr"."users"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_am_details" ADD CONSTRAINT "activity_am_details_activity_xid_fkey" FOREIGN KEY ("activity_xid") REFERENCES "act"."activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_am_details" ADD CONSTRAINT "activity_am_details_account_manager_xid_fkey" FOREIGN KEY ("account_manager_xid") REFERENCES "usr"."users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_prices" ADD CONSTRAINT "activity_prices_activity_venue_xid_fkey" FOREIGN KEY ("activity_venue_xid") REFERENCES "act"."activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_price_taxes" ADD CONSTRAINT "activity_price_taxes_activity_price_xid_fkey" FOREIGN KEY ("activity_price_xid") REFERENCES "act"."activity_prices"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_price_taxes" ADD CONSTRAINT "activity_price_taxes_tax_xid_fkey" FOREIGN KEY ("tax_xid") REFERENCES "mst"."taxes"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_venue_artifacts" ADD CONSTRAINT "activity_venue_artifacts_activity_venue_xid_fkey" FOREIGN KEY ("activity_venue_xid") REFERENCES "act"."activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_pqq_header" ADD CONSTRAINT "activity_pqq_header_activity_xid_fkey" FOREIGN KEY ("activity_xid") REFERENCES "act"."activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_pqq_header" ADD CONSTRAINT "activity_pqq_header_pqq_question_xid_fkey" FOREIGN KEY ("pqq_question_xid") REFERENCES "mst"."pqq_questions"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_pqq_header" ADD CONSTRAINT "activity_pqq_header_pqq_answer_xid_fkey" FOREIGN KEY ("pqq_answer_xid") REFERENCES "mst"."pqq_answers"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_pqq_suggestions" ADD CONSTRAINT "activity_pqq_suggestions_activity_pqq_header_xid_fkey" FOREIGN KEY ("activity_pqq_header_xid") REFERENCES "act"."activity_pqq_header"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_pqq_suggestions" ADD CONSTRAINT "activity_pqq_suggestions_reviewed_by_xid_fkey" FOREIGN KEY ("reviewed_by_xid") REFERENCES "usr"."users"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_pqq_supportings" ADD CONSTRAINT "activity_pqq_supportings_activity_pqq_header_xid_fkey" FOREIGN KEY ("activity_pqq_header_xid") REFERENCES "act"."activity_pqq_header"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_allowed_entry" ADD CONSTRAINT "activity_allowed_entry_activity_xid_fkey" FOREIGN KEY ("activity_xid") REFERENCES "act"."activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_allowed_entry" ADD CONSTRAINT "activity_allowed_entry_allowed_entry_type_xid_fkey" FOREIGN KEY ("allowed_entry_type_xid") REFERENCES "mst"."allowed_entry_types"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_food_details" ADD CONSTRAINT "activity_food_details_activity_xid_fkey" FOREIGN KEY ("activity_xid") REFERENCES "act"."activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_food_details" ADD CONSTRAINT "activity_food_details_food_type_xid_fkey" FOREIGN KEY ("food_type_xid") REFERENCES "mst"."food_types"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_food_taxes" ADD CONSTRAINT "activity_food_taxes_activity_food_details_xid_fkey" FOREIGN KEY ("activity_food_details_xid") REFERENCES "act"."activity_food_details"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_food_taxes" ADD CONSTRAINT "activity_food_taxes_tax_xid_fkey" FOREIGN KEY ("tax_xid") REFERENCES "mst"."taxes"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_equipments" ADD CONSTRAINT "activity_equipments_activity_xid_fkey" FOREIGN KEY ("activity_xid") REFERENCES "act"."activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_equipment_taxes" ADD CONSTRAINT "activity_equipment_taxes_activity_equipment_xid_fkey" FOREIGN KEY ("activity_equipment_xid") REFERENCES "act"."activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_equipment_taxes" ADD CONSTRAINT "activity_equipment_taxes_tax_xid_fkey" FOREIGN KEY ("tax_xid") REFERENCES "mst"."taxes"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_navigation_modes" ADD CONSTRAINT "activity_navigation_modes_activity_xid_fkey" FOREIGN KEY ("activity_xid") REFERENCES "act"."activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_navigation_modes" ADD CONSTRAINT "activity_navigation_modes_navigation_mode_xid_fkey" FOREIGN KEY ("navigation_mode_xid") REFERENCES "mst"."navigation_modes"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_navigation_modes_taxes" ADD CONSTRAINT "activity_navigation_modes_taxes_activity_navigation_mode_x_fkey" FOREIGN KEY ("activity_navigation_mode_xid") REFERENCES "act"."activity_navigation_modes"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_navigation_modes_taxes" ADD CONSTRAINT "activity_navigation_modes_taxes_tax_xid_fkey" FOREIGN KEY ("tax_xid") REFERENCES "mst"."taxes"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_pick_up_details" ADD CONSTRAINT "activity_pick_up_details_activity_xid_fkey" FOREIGN KEY ("activity_xid") REFERENCES "act"."activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_pick_up_transport" ADD CONSTRAINT "activity_pick_up_transport_activity_pick_up_details_xid_fkey" FOREIGN KEY ("activity_pick_up_details_xid") REFERENCES "act"."activity_pick_up_details"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_pick_up_transport" ADD CONSTRAINT "activity_pick_up_transport_transport_mode_xid_fkey" FOREIGN KEY ("transport_mode_xid") REFERENCES "mst"."transport_modes"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_pick_up_transport_taxes" ADD CONSTRAINT "activity_pick_up_transport_taxes_activity_pick_up_transpor_fkey" FOREIGN KEY ("activity_pick_up_transport_xid") REFERENCES "act"."activity_pick_up_transport"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_pick_up_transport_taxes" ADD CONSTRAINT "activity_pick_up_transport_taxes_tax_xid_fkey" FOREIGN KEY ("tax_xid") REFERENCES "mst"."taxes"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_amenities" ADD CONSTRAINT "activity_amenities_activity_xid_fkey" FOREIGN KEY ("activity_xid") REFERENCES "act"."activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_amenities" ADD CONSTRAINT "activity_amenities_amenities_xid_fkey" FOREIGN KEY ("amenities_xid") REFERENCES "mst"."amenities"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "sch"."schedule_header" ADD CONSTRAINT "schedule_header_activity_xid_fkey" FOREIGN KEY ("activity_xid") REFERENCES "act"."activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "sch"."schedule_header" ADD CONSTRAINT "schedule_header_activity_venue_xid_fkey" FOREIGN KEY ("activity_venue_xid") REFERENCES "act"."activity_venues"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "sch"."schedule_details" ADD CONSTRAINT "schedule_details_schedule_header_xid_fkey" FOREIGN KEY ("schedule_header_xid") REFERENCES "sch"."schedule_header"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."cancellations" ADD CONSTRAINT "cancellations_schedule_header_xid_fkey" FOREIGN KEY ("schedule_header_xid") REFERENCES "sch"."schedule_header"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "itn"."itinerary_header" ADD CONSTRAINT "itinerary_header_owner_xid_fkey" FOREIGN KEY ("owner_xid") REFERENCES "usr"."users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "itn"."itinerary_members" ADD CONSTRAINT "itinerary_members_itinerary_header_xid_fkey" FOREIGN KEY ("itinerary_header_xid") REFERENCES "itn"."itinerary_header"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "itn"."itinerary_members" ADD CONSTRAINT "itinerary_members_member_xid_fkey" FOREIGN KEY ("member_xid") REFERENCES "usr"."users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "itn"."itinerary_members" ADD CONSTRAINT "itinerary_members_invited_by_xid_fkey" FOREIGN KEY ("invited_by_xid") REFERENCES "usr"."users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "itn"."itinerary_members" ADD CONSTRAINT "itinerary_members_userId_fkey" FOREIGN KEY ("userId") REFERENCES "usr"."users"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "itn"."itinerary_start_stop_details" ADD CONSTRAINT "itinerary_start_stop_details_itinerary_header_xid_fkey" FOREIGN KEY ("itinerary_header_xid") REFERENCES "itn"."itinerary_header"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "itn"."itinerary_start_stop_details" ADD CONSTRAINT "itinerary_start_stop_details_itinerary_member_xid_fkey" FOREIGN KEY ("itinerary_member_xid") REFERENCES "itn"."itinerary_members"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "itn"."itinerary_activities" ADD CONSTRAINT "itinerary_activities_itinerary_header_xid_fkey" FOREIGN KEY ("itinerary_header_xid") REFERENCES "itn"."itinerary_header"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "itn"."itinerary_activities" ADD CONSTRAINT "itinerary_activities_activity_xid_fkey" FOREIGN KEY ("activity_xid") REFERENCES "act"."activities"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "itn"."itinerary_activities" ADD CONSTRAINT "itinerary_activities_scheduled_header_xid_fkey" FOREIGN KEY ("scheduled_header_xid") REFERENCES "sch"."schedule_header"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "itn"."itinerary_activities" ADD CONSTRAINT "itinerary_activities_venue_xid_fkey" FOREIGN KEY ("venue_xid") REFERENCES "act"."activity_venues"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_sos_details" ADD CONSTRAINT "activity_sos_details_itinerary_activity_xid_fkey" FOREIGN KEY ("itinerary_activity_xid") REFERENCES "itn"."itinerary_activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_sos_details" ADD CONSTRAINT "activity_sos_details_updated_by_xid_fkey" FOREIGN KEY ("updated_by_xid") REFERENCES "usr"."users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_feedbacks" ADD CONSTRAINT "activity_feedbacks_itinerary_activity_xid_fkey" FOREIGN KEY ("itinerary_activity_xid") REFERENCES "itn"."itinerary_activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "act"."activity_feedbacks" ADD CONSTRAINT "activity_feedbacks_member_xid_fkey" FOREIGN KEY ("member_xid") REFERENCES "usr"."users"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "itn"."itinerary_details" ADD CONSTRAINT "itinerary_details_itinerary_activity_xid_fkey" FOREIGN KEY ("itinerary_activity_xid") REFERENCES "itn"."itinerary_activities"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "itn"."itinerary_details" ADD CONSTRAINT "itinerary_details_itinerary_member_xid_fkey" FOREIGN KEY ("itinerary_member_xid") REFERENCES "itn"."itinerary_members"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "itn"."itinerary_details" ADD CONSTRAINT "itinerary_details_paid_by_xid_fkey" FOREIGN KEY ("paid_by_xid") REFERENCES "usr"."users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "itn"."itinerary_detail_taxes" ADD CONSTRAINT "itinerary_detail_taxes_itinerary_detail_xid_fkey" FOREIGN KEY ("itinerary_detail_xid") REFERENCES "itn"."itinerary_details"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "itn"."itinerary_detail_taxes" ADD CONSTRAINT "itinerary_detail_taxes_tax_xid_fkey" FOREIGN KEY ("tax_xid") REFERENCES "mst"."taxes"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
