From 3e3895cf6338791643137ab348ac00364c5d7320 Mon Sep 17 00:00:00 2001 From: PrathviNiveus <prathviraj.thokal@niveussolutions.com> Date: Wed, 28 May 2025 12:08:16 +0530 Subject: [PATCH 1/4] Changes - ID added as default, updatedAt change, corrected spelling specialty to speciality table, seeded the file --- .../20250528061344_added_tables/migration.sql | 1 + .../migration.sql | 28 ++ prisma/models/city_master.prisma | 4 +- prisma/models/hospital.prisma | 4 +- prisma/models/hospital_accommodations.prisma | 4 +- prisma/models/hospital_bank_details.prisma | 4 +- prisma/models/hospital_care_master.prisma | 4 +- prisma/models/hospital_contact_persons.prisma | 4 +- prisma/models/hospital_corporate.prisma | 4 +- prisma/models/hospital_discount_master.prisma | 4 +- prisma/models/hospital_discounts.prisma | 6 +- .../hospital_fraud_remarks_master.prisma | 4 +- prisma/models/hospital_room_categories.prisma | 4 +- prisma/models/hospital_room_types.prisma | 4 +- prisma/models/hospital_specialities.prisma | 6 +- ...isma => hospital_speciality_master.prisma} | 6 +- prisma/models/hospital_tariff_master.prisma | 4 +- .../models/hospital_tariff_type_master.prisma | 4 +- prisma/models/hospital_tariffs.prisma | 4 +- prisma/models/hospital_type_master.prisma | 4 +- prisma/models/hospital_zone_master.prisma | 4 +- prisma/models/state_master.prisma | 4 +- prisma/models/user.prisma | 4 +- src/seed.ts | 252 ++++++++++++++++-- 24 files changed, 304 insertions(+), 67 deletions(-) create mode 100644 prisma/migrations/20250528061344_added_tables/migration.sql create mode 100644 prisma/migrations/20250528062809_db_changes_updated_at_and_id_default/migration.sql rename prisma/models/{hospital_specialty_master.prisma => hospital_speciality_master.prisma} (50%) diff --git a/prisma/migrations/20250528061344_added_tables/migration.sql b/prisma/migrations/20250528061344_added_tables/migration.sql new file mode 100644 index 0000000..af5102c --- /dev/null +++ b/prisma/migrations/20250528061344_added_tables/migration.sql @@ -0,0 +1 @@ +-- This is an empty migration. \ No newline at end of file diff --git a/prisma/migrations/20250528062809_db_changes_updated_at_and_id_default/migration.sql b/prisma/migrations/20250528062809_db_changes_updated_at_and_id_default/migration.sql new file mode 100644 index 0000000..873f040 --- /dev/null +++ b/prisma/migrations/20250528062809_db_changes_updated_at_and_id_default/migration.sql @@ -0,0 +1,28 @@ +/* + Warnings: + + - You are about to drop the `hospital_specialty_master` table. If the table is not empty, all the data it contains will be lost. + +*/ +-- DropForeignKey +ALTER TABLE "hospital_specialities" DROP CONSTRAINT "hospital_specialities_speciality_id_fkey"; + +-- AlterTable +ALTER TABLE "hospital_discounts" ALTER COLUMN "created_at" SET DEFAULT CURRENT_TIMESTAMP; + +-- DropTable +DROP TABLE "hospital_specialty_master"; + +-- CreateTable +CREATE TABLE "hospital_speciality_master" ( + "id" UUID NOT NULL, + "name" TEXT NOT NULL, + "is_active" BOOLEAN NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "hospital_speciality_master_pkey" PRIMARY KEY ("id") +); + +-- AddForeignKey +ALTER TABLE "hospital_specialities" ADD CONSTRAINT "hospital_specialities_speciality_id_fkey" FOREIGN KEY ("speciality_id") REFERENCES "hospital_speciality_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/models/city_master.prisma b/prisma/models/city_master.prisma index 225c9bf..f631f40 100644 --- a/prisma/models/city_master.prisma +++ b/prisma/models/city_master.prisma @@ -1,9 +1,9 @@ model city_master { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid name String state_id String @db.Uuid created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt hospital hospital[] hospital_bank_details hospital_bank_details[] hospital_corporate hospital_corporate[] diff --git a/prisma/models/hospital.prisma b/prisma/models/hospital.prisma index a738120..0e7b127 100644 --- a/prisma/models/hospital.prisma +++ b/prisma/models/hospital.prisma @@ -5,7 +5,7 @@ enum hospital_status { } model hospital { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid hospital_no String @unique rohini_id String @unique hfr_id String @unique @@ -46,7 +46,7 @@ model hospital { created_by String @db.Uuid updated_by String @db.Uuid created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt city_master city_master @relation(fields: [city_id], references: [id]) hospital_corporate hospital_corporate @relation(fields: [corporate_id], references: [id]) user_hospital_created_byTouser user @relation("hospital_created_byTouser", fields: [created_by], references: [id]) diff --git a/prisma/models/hospital_accommodations.prisma b/prisma/models/hospital_accommodations.prisma index ea69042..277ba9d 100644 --- a/prisma/models/hospital_accommodations.prisma +++ b/prisma/models/hospital_accommodations.prisma @@ -1,10 +1,10 @@ model hospital_accommodations { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid hospital_id String @db.Uuid room_category_id String @db.Uuid bed_count Int created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt is_active Boolean hospital hospital @relation(fields: [hospital_id], references: [id]) hospital_room_categories hospital_room_categories @relation(fields: [room_category_id], references: [id]) diff --git a/prisma/models/hospital_bank_details.prisma b/prisma/models/hospital_bank_details.prisma index a5bee30..9ce5cb2 100644 --- a/prisma/models/hospital_bank_details.prisma +++ b/prisma/models/hospital_bank_details.prisma @@ -9,7 +9,7 @@ enum account_type { } model hospital_bank_details { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid hospital_id String @db.Uuid name String address String @@ -32,7 +32,7 @@ model hospital_bank_details { created_by String @db.Uuid updated_by String @db.Uuid created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt city_master city_master @relation(fields: [city_id], references: [id]) user_hospital_bank_details_created_byTouser user @relation("hospital_bank_details_created_byTouser", fields: [created_by], references: [id]) hospital hospital @relation(fields: [hospital_id], references: [id]) diff --git a/prisma/models/hospital_care_master.prisma b/prisma/models/hospital_care_master.prisma index a1da3ba..73800de 100644 --- a/prisma/models/hospital_care_master.prisma +++ b/prisma/models/hospital_care_master.prisma @@ -1,8 +1,8 @@ model hospital_care_master { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid name String is_active Boolean created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt hospital hospital[] } \ No newline at end of file diff --git a/prisma/models/hospital_contact_persons.prisma b/prisma/models/hospital_contact_persons.prisma index 3408022..1b65fc2 100644 --- a/prisma/models/hospital_contact_persons.prisma +++ b/prisma/models/hospital_contact_persons.prisma @@ -1,5 +1,5 @@ model hospital_contact_persons { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid hospital_id String @db.Uuid name String designation String @@ -9,7 +9,7 @@ model hospital_contact_persons { updated_by String @db.Uuid is_active Boolean created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt user_hospital_contact_persons_created_byTouser user @relation("hospital_contact_persons_created_byTouser", fields: [created_by], references: [id]) hospital hospital @relation(fields: [hospital_id], references: [id]) user_hospital_contact_persons_updated_byTouser user @relation("hospital_contact_persons_updated_byTouser", fields: [updated_by], references: [id]) diff --git a/prisma/models/hospital_corporate.prisma b/prisma/models/hospital_corporate.prisma index fc2c51e..5e4e483 100644 --- a/prisma/models/hospital_corporate.prisma +++ b/prisma/models/hospital_corporate.prisma @@ -1,5 +1,5 @@ model hospital_corporate { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid name String address String locality String @@ -17,7 +17,7 @@ model hospital_corporate { created_by String @db.Uuid updated_by String @db.Uuid created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt hospital hospital[] city_master city_master @relation(fields: [city_id], references: [id]) user_hospital_corporate_created_byTouser user @relation("hospital_corporate_created_byTouser", fields: [created_by], references: [id]) diff --git a/prisma/models/hospital_discount_master.prisma b/prisma/models/hospital_discount_master.prisma index 1ce7a7f..7eaa0f4 100644 --- a/prisma/models/hospital_discount_master.prisma +++ b/prisma/models/hospital_discount_master.prisma @@ -1,8 +1,8 @@ model hospital_discount_master { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid name String is_active Boolean created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt hospital_discounts hospital_discounts[] } \ No newline at end of file diff --git a/prisma/models/hospital_discounts.prisma b/prisma/models/hospital_discounts.prisma index e586983..29d04da 100644 --- a/prisma/models/hospital_discounts.prisma +++ b/prisma/models/hospital_discounts.prisma @@ -1,5 +1,5 @@ model hospital_discounts { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid hospital_id String @db.Uuid discount_id String @db.Uuid discount Decimal @db.Decimal(5, 2) @@ -7,8 +7,8 @@ model hospital_discounts { effective_till DateTime created_by String @db.Uuid updated_by String @db.Uuid - created_at DateTime - updated_at DateTime + created_at DateTime @default(now()) + updated_at DateTime @updatedAt user_hospital_discounts_created_byTouser user @relation("hospital_discounts_created_byTouser", fields: [created_by], references: [id]) hospital_discount_master hospital_discount_master @relation(fields: [discount_id], references: [id]) hospital hospital @relation(fields: [hospital_id], references: [id]) diff --git a/prisma/models/hospital_fraud_remarks_master.prisma b/prisma/models/hospital_fraud_remarks_master.prisma index 8a05ba5..7696ba6 100644 --- a/prisma/models/hospital_fraud_remarks_master.prisma +++ b/prisma/models/hospital_fraud_remarks_master.prisma @@ -1,8 +1,8 @@ model hospital_fraud_remarks_master { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid name String is_active Boolean created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt hospital hospital[] } \ No newline at end of file diff --git a/prisma/models/hospital_room_categories.prisma b/prisma/models/hospital_room_categories.prisma index 69d4586..957747a 100644 --- a/prisma/models/hospital_room_categories.prisma +++ b/prisma/models/hospital_room_categories.prisma @@ -1,10 +1,10 @@ model hospital_room_categories { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid name String room_id String @db.Uuid is_active Boolean created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt hospital_accommodations hospital_accommodations[] hospital_room_types hospital_room_types @relation(fields: [room_id], references: [id]) } \ No newline at end of file diff --git a/prisma/models/hospital_room_types.prisma b/prisma/models/hospital_room_types.prisma index 7e2d390..aa66077 100644 --- a/prisma/models/hospital_room_types.prisma +++ b/prisma/models/hospital_room_types.prisma @@ -1,8 +1,8 @@ model hospital_room_types { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid name String is_active Boolean created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt hospital_room_categories hospital_room_categories[] } \ No newline at end of file diff --git a/prisma/models/hospital_specialities.prisma b/prisma/models/hospital_specialities.prisma index f00e6ef..6838656 100644 --- a/prisma/models/hospital_specialities.prisma +++ b/prisma/models/hospital_specialities.prisma @@ -1,10 +1,10 @@ model hospital_specialities { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid hospital_id String @db.Uuid speciality_id String @db.Uuid is_active Boolean created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt hospital hospital @relation(fields: [hospital_id], references: [id]) - hospital_specialty_master hospital_specialty_master @relation(fields: [speciality_id], references: [id]) + hospital_speciality_master hospital_speciality_master @relation(fields: [speciality_id], references: [id]) } \ No newline at end of file diff --git a/prisma/models/hospital_specialty_master.prisma b/prisma/models/hospital_speciality_master.prisma similarity index 50% rename from prisma/models/hospital_specialty_master.prisma rename to prisma/models/hospital_speciality_master.prisma index d9e2b86..c294ace 100644 --- a/prisma/models/hospital_specialty_master.prisma +++ b/prisma/models/hospital_speciality_master.prisma @@ -1,8 +1,8 @@ -model hospital_specialty_master { - id String @id @db.Uuid +model hospital_speciality_master { + id String @id @default(uuid()) @db.Uuid name String is_active Boolean created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt hospital_specialities hospital_specialities[] } \ No newline at end of file diff --git a/prisma/models/hospital_tariff_master.prisma b/prisma/models/hospital_tariff_master.prisma index b0dc099..8cd3860 100644 --- a/prisma/models/hospital_tariff_master.prisma +++ b/prisma/models/hospital_tariff_master.prisma @@ -6,13 +6,13 @@ enum TariffLevel { } model hospital_tariff_master { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid name String parent_id String? @db.Uuid level TariffLevel is_active Boolean created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt hospital_tariff_master hospital_tariff_master? @relation("hospital_tariff_masterTohospital_tariff_master", fields: [parent_id], references: [id]) other_hospital_tariff_master hospital_tariff_master[] @relation("hospital_tariff_masterTohospital_tariff_master") hospital_tariffs_hospital_tariffs_tariff_category_idTohospital_tariff_master hospital_tariffs[] @relation("hospital_tariffs_tariff_category_idTohospital_tariff_master") diff --git a/prisma/models/hospital_tariff_type_master.prisma b/prisma/models/hospital_tariff_type_master.prisma index 9f59b49..725d19e 100644 --- a/prisma/models/hospital_tariff_type_master.prisma +++ b/prisma/models/hospital_tariff_type_master.prisma @@ -1,8 +1,8 @@ model hospital_tariff_type_master { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid name String is_active Boolean created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt hospital_tariffs hospital_tariffs[] } \ No newline at end of file diff --git a/prisma/models/hospital_tariffs.prisma b/prisma/models/hospital_tariffs.prisma index 336c132..33652d1 100644 --- a/prisma/models/hospital_tariffs.prisma +++ b/prisma/models/hospital_tariffs.prisma @@ -1,5 +1,5 @@ model hospital_tariffs { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid hospital_id String @db.Uuid tariff_id String @db.Uuid tariff_category_id String @db.Uuid @@ -12,7 +12,7 @@ model hospital_tariffs { created_by String @db.Uuid updated_by String @db.Uuid created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt user_hospital_tariffs_created_byTouser user @relation("hospital_tariffs_created_byTouser", fields: [created_by], references: [id]) hospital hospital @relation(fields: [hospital_id], references: [id]) hospital_tariff_master_hospital_tariffs_tariff_category_idTohospital_tariff_master hospital_tariff_master @relation("hospital_tariffs_tariff_category_idTohospital_tariff_master", fields: [tariff_category_id], references: [id]) diff --git a/prisma/models/hospital_type_master.prisma b/prisma/models/hospital_type_master.prisma index e9e8132..6b2bde6 100644 --- a/prisma/models/hospital_type_master.prisma +++ b/prisma/models/hospital_type_master.prisma @@ -1,8 +1,8 @@ model hospital_type_master { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid name String is_active Boolean created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt hospital hospital[] } \ No newline at end of file diff --git a/prisma/models/hospital_zone_master.prisma b/prisma/models/hospital_zone_master.prisma index 478afad..b68069d 100644 --- a/prisma/models/hospital_zone_master.prisma +++ b/prisma/models/hospital_zone_master.prisma @@ -1,9 +1,9 @@ model hospital_zone_master { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid name String is_active Boolean created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt hospital hospital[] hospital_corporate hospital_corporate[] } \ No newline at end of file diff --git a/prisma/models/state_master.prisma b/prisma/models/state_master.prisma index aa227ca..adcbee0 100644 --- a/prisma/models/state_master.prisma +++ b/prisma/models/state_master.prisma @@ -1,10 +1,10 @@ model state_master { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid name String abbv String created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt hospital hospital[] hospital_bank_details hospital_bank_details[] hospital_corporate hospital_corporate[] diff --git a/prisma/models/user.prisma b/prisma/models/user.prisma index 69fe08f..9fcd3cd 100644 --- a/prisma/models/user.prisma +++ b/prisma/models/user.prisma @@ -5,14 +5,14 @@ enum Role { } model user { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid name String email String @unique hashemail String password String role Role created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt hospital_hospital_created_byTouser hospital[] @relation("hospital_created_byTouser") hospital_hospital_updated_byTouser hospital[] @relation("hospital_updated_byTouser") hospital_bank_details_hospital_bank_details_created_byTouser hospital_bank_details[] @relation("hospital_bank_details_created_byTouser") diff --git a/src/seed.ts b/src/seed.ts index 11e1898..fca6a8e 100644 --- a/src/seed.ts +++ b/src/seed.ts @@ -13,34 +13,242 @@ const prisma = new PrismaService(); // Sample user data to seed into the database const userData = [ - { - name: 'Roshan', - email: 'roshanadmin@niveus.com', - hashemail: 'roshanadmin@niveus.com', - password: '123456', - role: 'admin' - }, - { - name: 'Roshanuser', - email: 'roshanuser@niveus.com', - hashemail: 'roshanuser@niveus.com', - password: '123456', - role: 'user' - }, + { + name: 'Roshan', + email: 'roshanadmin@niveus.com', + hashemail: 'roshanadmin@niveus.com', + password: '123456', + role: 'admin', + }, + { + name: 'Roshanuser', + email: 'roshanuser@niveus.com', + hashemail: 'roshanuser@niveus.com', + password: '123456', + role: 'user', + }, + { + name: 'Prathviraj', + email: 'prathviraj.thokal@niveus.com', + hashemail: 'prathviraj.thokal@niveus.com', + password: '123456', + role: 'admin', + }, + { + name: 'Prathviuser', + email: 'prathviraj.thokal@niveus.com', + hashemail: 'prathviraj.thokal@niveus.com', + password: '123456', + role: 'user', + }, +]; + +const hospitalSpecialtyMasterData = [ + { name: 'Super-Speciality', is_active: true }, + { name: 'Multi-Speciality', is_active: true }, + { name: 'Cancer Hospital', is_active: true }, + { name: 'Maternity', is_active: true }, + { name: 'Eye Hospital', is_active: true }, + { name: 'ENT', is_active: true }, + { name: 'Orthopedic', is_active: true }, + { name: 'Nursing Home', is_active: true }, + { name: 'Ayurvedic', is_active: true }, + { name: 'Dental', is_active: true }, + { name: 'Childcare/Pediatric', is_active: true }, + { name: 'Daycare', is_active: true }, + { name: 'Urology', is_active: true }, + { name: 'General Hospital', is_active: true }, + { name: 'Surgical', is_active: true }, + { name: 'Secondary', is_active: true }, + { name: 'Nurology', is_active: true }, + { name: 'BURNS', is_active: true }, + { name: 'COVID Temporary Hospital', is_active: true }, + { name: 'Cardiac', is_active: true }, +]; + +const hospitalTypeMasterData = [ + { name: 'Government', is_active: true }, + { name: 'Corporate', is_active: true }, + { name: 'Private', is_active: true }, + { name: 'Mission', is_active: true }, + { name: 'Trust', is_active: true }, + { name: 'Memorial', is_active: true }, + { name: 'Individual', is_active: true }, + { name: 'Research Institute', is_active: true }, +]; + +const hospitalCareMasterData = [ + { name: 'Primary', is_active: true }, + { name: 'Secondary', is_active: true }, + { name: 'Tertiary', is_active: true }, + { name: 'Tertiary Plus', is_active: true }, +]; + +const hospitalDiscountMasterData = [ + { name: 'ICU Charges', is_active: true }, + { name: 'Implant', is_active: true }, + { name: 'Investigation Charges', is_active: true }, + { name: 'Medical package', is_active: true }, + { name: 'Medicine & Consumables charges', is_active: true }, + { name: 'Miscellaneous charges', is_active: true }, + { name: 'OT Charges', is_active: true }, + { name: 'Other Expenses', is_active: true }, + { name: 'Package Charges', is_active: true }, + { name: 'Pharmacy Bill Charge', is_active: true }, + { name: 'Pharmacy Charges', is_active: true }, + { name: 'Professional Fees Charges', is_active: true }, +]; + +const hospitalRoomTypesData = [ + { name: 'ROOM', is_active: true }, + { name: 'ICU', is_active: true }, +]; + +const hospitalRoomCategoriesData = [ + { + id: 'e40e43df-0c1b-46f5-9204-bb2dc2e9e32e', + name: 'General', + room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', + is_active: true, + }, + { + id: 'ec165d89-06f3-49e2-9d9e-504e90272836', + name: 'Semi-Private', + room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', + is_active: true, + }, + { + id: 'df7e0e91-9dc9-41de-9215-3a72c54d1d9d', + name: 'Private', + room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', + is_active: true, + }, + { + id: '27e4c841-bde1-45fc-a257-552cc0b8724b', + name: 'Deluxe', + room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', + is_active: true, + }, + { + id: '8d1fd0e0-9c50-4fc6-9eaa-3dc61746e68c', + name: 'Super Deluxe', + room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', + is_active: true, + }, + { + id: 'a02e93f2-01a9-466e-a08b-f00a8ec3eb02', + name: 'Suite', + room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', + is_active: true, + }, + { + id: 'ea93f9d0-6a2c-4be5-bd2d-fb93f2c6e72d', + name: 'ICU', + room_id: '12967281-eaf1-47d3-9a69-1f4c0bb28e89', + is_active: true, + }, + { + id: 'b8cbd4dc-3bcb-4b36-9912-41dfd3c9b6b0', + name: 'NICU', + room_id: '12967281-eaf1-47d3-9a69-1f4c0bb28e89', + is_active: true, + }, + { + id: 'bc9f27ae-dc6b-4de4-9a6c-cb2f96dcad6a', + name: 'Private - AC', + room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', + is_active: true, + }, + { + id: '4500cb1c-6223-44e1-a4e5-2b1c17e0668e', + name: 'Private - DAC', + room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', + is_active: true, + }, + { + id: '5d5e1e58-91ef-4461-a7f4-8e908e3d8100', + name: 'HDUI - High Dependency Unit', + room_id: '12967281-eaf1-47d3-9a69-1f4c0bb28e89', + is_active: true, + }, + { + id: '1d01cc33-b6b0-4e56-b7cb-32e58bc1f28f', + name: 'CCU - Cardiac Care Unit', + room_id: '12967281-eaf1-47d3-9a69-1f4c0bb28e89', + is_active: true, + }, + { + id: '30f60bb4-7c72-4b4e-8f44-ef31bfc1d568', + name: 'Day Care', + room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', + is_active: true, + }, + { + id: '0a2db7ed-82e5-45ff-970a-c5d0b08db1f7', + name: 'Isolation Room', + room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', + is_active: true, + }, + { + id: '2e4be885-95a2-4141-bc3b-1b95a6acac1f', + name: 'Triple Share', + room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', + is_active: true, + }, + { + id: '8579e20c-d6b6-4f4b-a353-18b32de810b7', + name: 'Labour Room', + room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', + is_active: true, + }, + { + id: '6842a6bc-5c91-4293-9b9a-8a93e11c69d9', + name: 'President Room', + room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', + is_active: true, + }, + { + id: 'b1961738-0282-4a88-a0a5-6f30dfc2eac1', + name: 'DIALYSIS', + room_id: '12967281-eaf1-47d3-9a69-1f4c0bb28e89', + is_active: true, + }, ]; /** * Seeds the user model with initial data. */ async function run() { - try { - await seedModel(prisma, 'user' as keyof PrismaService, userData); - console.log('User data seeded successfully.'); - } catch (error) { - console.error('Error seeding user data:', error); - } finally { - await prisma.$disconnect(); - } + try { + await seedModel(prisma, 'user' as keyof PrismaService, userData); + await seedModel( + prisma, + 'hospital_speciality_master' as keyof PrismaService, + hospitalSpecialtyMasterData, + ); + await seedModel( + prisma, + 'hospital_type_master' as keyof PrismaService, + hospitalTypeMasterData, + ); + await seedModel(prisma, 'hospital_care_master', hospitalCareMasterData); + await seedModel( + prisma, + 'hospital_discount_master', + hospitalDiscountMasterData, + ); + await seedModel(prisma, 'hospital_room_types', hospitalRoomTypesData); + // await seedModel( + // prisma, + // 'hospital_room_categories', + // hospitalRoomCategoriesData, + // ); + console.log('User data seeded successfully.'); + } catch (error) { + console.error('Error seeding user data:', error); + } finally { + await prisma.$disconnect(); + } } // Execute the seed function -- GitLab From 303a289f8a16979bbcfde7fcb32ed2e91cc14304 Mon Sep 17 00:00:00 2001 From: "prathviraj.thokal" <prathviraj.thokal@niveussolutions.com> Date: Wed, 28 May 2025 14:19:29 +0530 Subject: [PATCH 2/4] added seed model --- src/seed.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/seed.ts b/src/seed.ts index fca6a8e..1bf0ad6 100644 --- a/src/seed.ts +++ b/src/seed.ts @@ -238,11 +238,11 @@ async function run() { hospitalDiscountMasterData, ); await seedModel(prisma, 'hospital_room_types', hospitalRoomTypesData); - // await seedModel( - // prisma, - // 'hospital_room_categories', - // hospitalRoomCategoriesData, - // ); + await seedModel( + prisma, + 'hospital_room_categories', + hospitalRoomCategoriesData, + ); console.log('User data seeded successfully.'); } catch (error) { console.error('Error seeding user data:', error); -- GitLab From 56e0e8e509466e6913bb0ddde763a4603e59e826 Mon Sep 17 00:00:00 2001 From: "prathviraj.thokal" <prathviraj.thokal@niveussolutions.com> Date: Wed, 28 May 2025 16:47:32 +0530 Subject: [PATCH 3/4] Added migrations file in gitignore and removed id from seed data --- .gitignore | 1 + src/seed.ts | 18 ------------------ 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 4b56acf..a5b1ea4 100755 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /dist /node_modules /build +/prisma/migrations # Logs logs diff --git a/src/seed.ts b/src/seed.ts index 1bf0ad6..449a555 100644 --- a/src/seed.ts +++ b/src/seed.ts @@ -106,109 +106,91 @@ const hospitalRoomTypesData = [ const hospitalRoomCategoriesData = [ { - id: 'e40e43df-0c1b-46f5-9204-bb2dc2e9e32e', name: 'General', room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', is_active: true, }, { - id: 'ec165d89-06f3-49e2-9d9e-504e90272836', name: 'Semi-Private', room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', is_active: true, }, { - id: 'df7e0e91-9dc9-41de-9215-3a72c54d1d9d', name: 'Private', room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', is_active: true, }, { - id: '27e4c841-bde1-45fc-a257-552cc0b8724b', name: 'Deluxe', room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', is_active: true, }, { - id: '8d1fd0e0-9c50-4fc6-9eaa-3dc61746e68c', name: 'Super Deluxe', room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', is_active: true, }, { - id: 'a02e93f2-01a9-466e-a08b-f00a8ec3eb02', name: 'Suite', room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', is_active: true, }, { - id: 'ea93f9d0-6a2c-4be5-bd2d-fb93f2c6e72d', name: 'ICU', room_id: '12967281-eaf1-47d3-9a69-1f4c0bb28e89', is_active: true, }, { - id: 'b8cbd4dc-3bcb-4b36-9912-41dfd3c9b6b0', name: 'NICU', room_id: '12967281-eaf1-47d3-9a69-1f4c0bb28e89', is_active: true, }, { - id: 'bc9f27ae-dc6b-4de4-9a6c-cb2f96dcad6a', name: 'Private - AC', room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', is_active: true, }, { - id: '4500cb1c-6223-44e1-a4e5-2b1c17e0668e', name: 'Private - DAC', room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', is_active: true, }, { - id: '5d5e1e58-91ef-4461-a7f4-8e908e3d8100', name: 'HDUI - High Dependency Unit', room_id: '12967281-eaf1-47d3-9a69-1f4c0bb28e89', is_active: true, }, { - id: '1d01cc33-b6b0-4e56-b7cb-32e58bc1f28f', name: 'CCU - Cardiac Care Unit', room_id: '12967281-eaf1-47d3-9a69-1f4c0bb28e89', is_active: true, }, { - id: '30f60bb4-7c72-4b4e-8f44-ef31bfc1d568', name: 'Day Care', room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', is_active: true, }, { - id: '0a2db7ed-82e5-45ff-970a-c5d0b08db1f7', name: 'Isolation Room', room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', is_active: true, }, { - id: '2e4be885-95a2-4141-bc3b-1b95a6acac1f', name: 'Triple Share', room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', is_active: true, }, { - id: '8579e20c-d6b6-4f4b-a353-18b32de810b7', name: 'Labour Room', room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', is_active: true, }, { - id: '6842a6bc-5c91-4293-9b9a-8a93e11c69d9', name: 'President Room', room_id: '7fecc4fb-1587-4cee-9ac0-9583172db109', is_active: true, }, { - id: 'b1961738-0282-4a88-a0a5-6f30dfc2eac1', name: 'DIALYSIS', room_id: '12967281-eaf1-47d3-9a69-1f4c0bb28e89', is_active: true, -- GitLab From 2b0a3362a374bfe73ed15553baa0828043a13afc Mon Sep 17 00:00:00 2001 From: "prathviraj.thokal" <prathviraj.thokal@niveussolutions.com> Date: Wed, 28 May 2025 16:54:59 +0530 Subject: [PATCH 4/4] added gitignore --- .../migration.sql | 482 ------------------ .../20250528061344_added_tables/migration.sql | 1 - .../migration.sql | 28 - prisma/migrations/migration_lock.toml | 3 - 4 files changed, 514 deletions(-) delete mode 100644 prisma/migrations/20250527093245_hospital_init/migration.sql delete mode 100644 prisma/migrations/20250528061344_added_tables/migration.sql delete mode 100644 prisma/migrations/20250528062809_db_changes_updated_at_and_id_default/migration.sql delete mode 100644 prisma/migrations/migration_lock.toml diff --git a/prisma/migrations/20250527093245_hospital_init/migration.sql b/prisma/migrations/20250527093245_hospital_init/migration.sql deleted file mode 100644 index 04ffe76..0000000 --- a/prisma/migrations/20250527093245_hospital_init/migration.sql +++ /dev/null @@ -1,482 +0,0 @@ --- CreateEnum -CREATE TYPE "hospital_status" AS ENUM ('ACTIVE', 'SUSPENDED', 'BLOCKED'); - --- CreateEnum -CREATE TYPE "account_mode" AS ENUM ('ECS', 'CHEQUE'); - --- CreateEnum -CREATE TYPE "account_type" AS ENUM ('SAVINGS', 'CURRENT'); - --- CreateEnum -CREATE TYPE "TariffLevel" AS ENUM ('CATEGORY', 'SUBCATEGORY', 'PROPERTY', 'SUBPROPERTY'); - --- CreateEnum -CREATE TYPE "Role" AS ENUM ('user', 'admin', 'moderator'); - --- CreateTable -CREATE TABLE "city_master" ( - "id" UUID NOT NULL, - "name" TEXT NOT NULL, - "state_id" UUID NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "city_master_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "hospital" ( - "id" UUID NOT NULL, - "hospital_no" TEXT NOT NULL, - "rohini_id" TEXT NOT NULL, - "hfr_id" TEXT NOT NULL, - "corporate_id" UUID NOT NULL, - "name" TEXT NOT NULL, - "propreitor_name" TEXT NOT NULL, - "address" TEXT NOT NULL, - "locality" TEXT NOT NULL, - "city_id" UUID NOT NULL, - "state_id" UUID NOT NULL, - "district_id" TEXT NOT NULL, - "region_id" UUID NOT NULL, - "pincode" TEXT NOT NULL, - "email_id" TEXT NOT NULL, - "bed_count" INTEGER NOT NULL, - "pan_no_hash" TEXT NOT NULL, - "tan_no_hash" TEXT NOT NULL, - "contact_hash" TEXT NOT NULL, - "website" TEXT NOT NULL, - "is_hospital_registered" BOOLEAN NOT NULL, - "registration_no" TEXT NOT NULL, - "registration_authority" TEXT NOT NULL, - "registered_from" TIMESTAMP(3) NOT NULL, - "registered_till" TIMESTAMP(3) NOT NULL, - "latitude" DECIMAL(9,6) NOT NULL, - "longitude" DECIMAL(9,6) NOT NULL, - "type_id" UUID NOT NULL, - "level_care_id" UUID NOT NULL, - "is_epd_enabled" BOOLEAN NOT NULL, - "epd_discount" DECIMAL(5,2) NOT NULL, - "epd_tat" INTEGER NOT NULL, - "epd_effective_from" TIMESTAMP(3) NOT NULL, - "epd_effective_till" TIMESTAMP(3) NOT NULL, - "is_non_network" BOOLEAN NOT NULL, - "status" "hospital_status" NOT NULL, - "fraud_remark_id" UUID NOT NULL, - "remarks" TEXT NOT NULL, - "created_by" UUID NOT NULL, - "updated_by" UUID NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "hospital_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "hospital_accommodations" ( - "id" UUID NOT NULL, - "hospital_id" UUID NOT NULL, - "room_category_id" UUID NOT NULL, - "bed_count" INTEGER NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - "is_active" BOOLEAN NOT NULL, - - CONSTRAINT "hospital_accommodations_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "hospital_bank_details" ( - "id" UUID NOT NULL, - "hospital_id" UUID NOT NULL, - "name" TEXT NOT NULL, - "address" TEXT NOT NULL, - "locality" TEXT NOT NULL, - "state_id" UUID NOT NULL, - "city_id" UUID NOT NULL, - "district_id" TEXT NOT NULL, - "pan_no_hash" TEXT NOT NULL, - "tan_no_hash" TEXT NOT NULL, - "account_type" "account_type" NOT NULL, - "account_no_hash" TEXT NOT NULL, - "ifsc_code" TEXT NOT NULL, - "micr_code" TEXT NOT NULL, - "branch_name" TEXT NOT NULL, - "bank_name" TEXT NOT NULL, - "payment_preference" "account_mode" NOT NULL, - "effective_from" TIMESTAMP(3) NOT NULL, - "effective_till" TIMESTAMP(3) NOT NULL, - "is_active" BOOLEAN NOT NULL, - "created_by" UUID NOT NULL, - "updated_by" UUID NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "hospital_bank_details_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "hospital_care_master" ( - "id" UUID NOT NULL, - "name" TEXT NOT NULL, - "is_active" BOOLEAN NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "hospital_care_master_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "hospital_contact_persons" ( - "id" UUID NOT NULL, - "hospital_id" UUID NOT NULL, - "name" TEXT NOT NULL, - "designation" TEXT NOT NULL, - "mobile" TEXT NOT NULL, - "email_id" TEXT NOT NULL, - "created_by" UUID NOT NULL, - "updated_by" UUID NOT NULL, - "is_active" BOOLEAN NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "hospital_contact_persons_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "hospital_corporate" ( - "id" UUID NOT NULL, - "name" TEXT NOT NULL, - "address" TEXT NOT NULL, - "locality" TEXT NOT NULL, - "state_id" UUID NOT NULL, - "city_id" UUID NOT NULL, - "district_id" TEXT NOT NULL, - "region_id" UUID NOT NULL, - "pincode" TEXT NOT NULL, - "email_id" TEXT NOT NULL, - "website" TEXT NOT NULL, - "contact_hash" TEXT NOT NULL, - "latitude" DECIMAL(9,6) NOT NULL, - "longitude" DECIMAL(9,6) NOT NULL, - "contact_no" TEXT NOT NULL, - "created_by" UUID NOT NULL, - "updated_by" UUID NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "hospital_corporate_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "hospital_discount_master" ( - "id" UUID NOT NULL, - "name" TEXT NOT NULL, - "is_active" BOOLEAN NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "hospital_discount_master_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "hospital_discounts" ( - "id" UUID NOT NULL, - "hospital_id" UUID NOT NULL, - "discount_id" UUID NOT NULL, - "discount" DECIMAL(5,2) NOT NULL, - "effective_from" TIMESTAMP(3) NOT NULL, - "effective_till" TIMESTAMP(3) NOT NULL, - "created_by" UUID NOT NULL, - "updated_by" UUID NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "hospital_discounts_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "hospital_fraud_remarks_master" ( - "id" UUID NOT NULL, - "name" TEXT NOT NULL, - "is_active" BOOLEAN NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "hospital_fraud_remarks_master_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "hospital_room_categories" ( - "id" UUID NOT NULL, - "name" TEXT NOT NULL, - "room_id" UUID NOT NULL, - "is_active" BOOLEAN NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "hospital_room_categories_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "hospital_room_types" ( - "id" UUID NOT NULL, - "name" TEXT NOT NULL, - "is_active" BOOLEAN NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "hospital_room_types_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "hospital_specialities" ( - "id" UUID NOT NULL, - "hospital_id" UUID NOT NULL, - "speciality_id" UUID NOT NULL, - "is_active" BOOLEAN NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "hospital_specialities_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "hospital_specialty_master" ( - "id" UUID NOT NULL, - "name" TEXT NOT NULL, - "is_active" BOOLEAN NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "hospital_specialty_master_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "hospital_tariff_master" ( - "id" UUID NOT NULL, - "name" TEXT NOT NULL, - "parent_id" UUID, - "level" "TariffLevel" NOT NULL, - "is_active" BOOLEAN NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "hospital_tariff_master_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "hospital_tariff_type_master" ( - "id" UUID NOT NULL, - "name" TEXT NOT NULL, - "is_active" BOOLEAN NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "hospital_tariff_type_master_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "hospital_tariffs" ( - "id" UUID NOT NULL, - "hospital_id" UUID NOT NULL, - "tariff_id" UUID NOT NULL, - "tariff_category_id" UUID NOT NULL, - "tariff_sub_category_id" UUID NOT NULL, - "tariff_property_id" UUID NOT NULL, - "tariff_sub_property_id" UUID NOT NULL, - "tariff_type_id" UUID NOT NULL, - "effective_from" TIMESTAMP(3) NOT NULL, - "effective_till" TIMESTAMP(3) NOT NULL, - "created_by" UUID NOT NULL, - "updated_by" UUID NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "hospital_tariffs_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "hospital_type_master" ( - "id" UUID NOT NULL, - "name" TEXT NOT NULL, - "is_active" BOOLEAN NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "hospital_type_master_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "hospital_zone_master" ( - "id" UUID NOT NULL, - "name" TEXT NOT NULL, - "is_active" BOOLEAN NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "hospital_zone_master_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "state_master" ( - "id" UUID NOT NULL, - "name" TEXT NOT NULL, - "abbv" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "state_master_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "user" ( - "id" UUID NOT NULL, - "name" TEXT NOT NULL, - "email" TEXT NOT NULL, - "hashemail" TEXT NOT NULL, - "password" TEXT NOT NULL, - "role" "Role" NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "user_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE UNIQUE INDEX "hospital_hospital_no_key" ON "hospital"("hospital_no"); - --- CreateIndex -CREATE UNIQUE INDEX "hospital_rohini_id_key" ON "hospital"("rohini_id"); - --- CreateIndex -CREATE UNIQUE INDEX "hospital_hfr_id_key" ON "hospital"("hfr_id"); - --- CreateIndex -CREATE UNIQUE INDEX "user_email_key" ON "user"("email"); - --- AddForeignKey -ALTER TABLE "city_master" ADD CONSTRAINT "city_master_state_id_fkey" FOREIGN KEY ("state_id") REFERENCES "state_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital" ADD CONSTRAINT "hospital_city_id_fkey" FOREIGN KEY ("city_id") REFERENCES "city_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital" ADD CONSTRAINT "hospital_corporate_id_fkey" FOREIGN KEY ("corporate_id") REFERENCES "hospital_corporate"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital" ADD CONSTRAINT "hospital_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital" ADD CONSTRAINT "hospital_fraud_remark_id_fkey" FOREIGN KEY ("fraud_remark_id") REFERENCES "hospital_fraud_remarks_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital" ADD CONSTRAINT "hospital_level_care_id_fkey" FOREIGN KEY ("level_care_id") REFERENCES "hospital_care_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital" ADD CONSTRAINT "hospital_region_id_fkey" FOREIGN KEY ("region_id") REFERENCES "hospital_zone_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital" ADD CONSTRAINT "hospital_state_id_fkey" FOREIGN KEY ("state_id") REFERENCES "state_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital" ADD CONSTRAINT "hospital_type_id_fkey" FOREIGN KEY ("type_id") REFERENCES "hospital_type_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital" ADD CONSTRAINT "hospital_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_accommodations" ADD CONSTRAINT "hospital_accommodations_hospital_id_fkey" FOREIGN KEY ("hospital_id") REFERENCES "hospital"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_accommodations" ADD CONSTRAINT "hospital_accommodations_room_category_id_fkey" FOREIGN KEY ("room_category_id") REFERENCES "hospital_room_categories"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_bank_details" ADD CONSTRAINT "hospital_bank_details_city_id_fkey" FOREIGN KEY ("city_id") REFERENCES "city_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_bank_details" ADD CONSTRAINT "hospital_bank_details_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_bank_details" ADD CONSTRAINT "hospital_bank_details_hospital_id_fkey" FOREIGN KEY ("hospital_id") REFERENCES "hospital"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_bank_details" ADD CONSTRAINT "hospital_bank_details_state_id_fkey" FOREIGN KEY ("state_id") REFERENCES "state_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_bank_details" ADD CONSTRAINT "hospital_bank_details_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_contact_persons" ADD CONSTRAINT "hospital_contact_persons_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_contact_persons" ADD CONSTRAINT "hospital_contact_persons_hospital_id_fkey" FOREIGN KEY ("hospital_id") REFERENCES "hospital"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_contact_persons" ADD CONSTRAINT "hospital_contact_persons_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_corporate" ADD CONSTRAINT "hospital_corporate_city_id_fkey" FOREIGN KEY ("city_id") REFERENCES "city_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_corporate" ADD CONSTRAINT "hospital_corporate_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_corporate" ADD CONSTRAINT "hospital_corporate_region_id_fkey" FOREIGN KEY ("region_id") REFERENCES "hospital_zone_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_corporate" ADD CONSTRAINT "hospital_corporate_state_id_fkey" FOREIGN KEY ("state_id") REFERENCES "state_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_corporate" ADD CONSTRAINT "hospital_corporate_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_discounts" ADD CONSTRAINT "hospital_discounts_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_discounts" ADD CONSTRAINT "hospital_discounts_discount_id_fkey" FOREIGN KEY ("discount_id") REFERENCES "hospital_discount_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_discounts" ADD CONSTRAINT "hospital_discounts_hospital_id_fkey" FOREIGN KEY ("hospital_id") REFERENCES "hospital"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_discounts" ADD CONSTRAINT "hospital_discounts_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_room_categories" ADD CONSTRAINT "hospital_room_categories_room_id_fkey" FOREIGN KEY ("room_id") REFERENCES "hospital_room_types"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_specialities" ADD CONSTRAINT "hospital_specialities_hospital_id_fkey" FOREIGN KEY ("hospital_id") REFERENCES "hospital"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_specialities" ADD CONSTRAINT "hospital_specialities_speciality_id_fkey" FOREIGN KEY ("speciality_id") REFERENCES "hospital_specialty_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_tariff_master" ADD CONSTRAINT "hospital_tariff_master_parent_id_fkey" FOREIGN KEY ("parent_id") REFERENCES "hospital_tariff_master"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_tariffs" ADD CONSTRAINT "hospital_tariffs_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_tariffs" ADD CONSTRAINT "hospital_tariffs_hospital_id_fkey" FOREIGN KEY ("hospital_id") REFERENCES "hospital"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_tariffs" ADD CONSTRAINT "hospital_tariffs_tariff_category_id_fkey" FOREIGN KEY ("tariff_category_id") REFERENCES "hospital_tariff_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_tariffs" ADD CONSTRAINT "hospital_tariffs_tariff_id_fkey" FOREIGN KEY ("tariff_id") REFERENCES "hospital_tariff_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_tariffs" ADD CONSTRAINT "hospital_tariffs_tariff_property_id_fkey" FOREIGN KEY ("tariff_property_id") REFERENCES "hospital_tariff_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_tariffs" ADD CONSTRAINT "hospital_tariffs_tariff_sub_category_id_fkey" FOREIGN KEY ("tariff_sub_category_id") REFERENCES "hospital_tariff_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_tariffs" ADD CONSTRAINT "hospital_tariffs_tariff_sub_property_id_fkey" FOREIGN KEY ("tariff_sub_property_id") REFERENCES "hospital_tariff_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_tariffs" ADD CONSTRAINT "hospital_tariffs_tariff_type_id_fkey" FOREIGN KEY ("tariff_type_id") REFERENCES "hospital_tariff_type_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "hospital_tariffs" ADD CONSTRAINT "hospital_tariffs_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20250528061344_added_tables/migration.sql b/prisma/migrations/20250528061344_added_tables/migration.sql deleted file mode 100644 index af5102c..0000000 --- a/prisma/migrations/20250528061344_added_tables/migration.sql +++ /dev/null @@ -1 +0,0 @@ --- This is an empty migration. \ No newline at end of file diff --git a/prisma/migrations/20250528062809_db_changes_updated_at_and_id_default/migration.sql b/prisma/migrations/20250528062809_db_changes_updated_at_and_id_default/migration.sql deleted file mode 100644 index 873f040..0000000 --- a/prisma/migrations/20250528062809_db_changes_updated_at_and_id_default/migration.sql +++ /dev/null @@ -1,28 +0,0 @@ -/* - Warnings: - - - You are about to drop the `hospital_specialty_master` table. If the table is not empty, all the data it contains will be lost. - -*/ --- DropForeignKey -ALTER TABLE "hospital_specialities" DROP CONSTRAINT "hospital_specialities_speciality_id_fkey"; - --- AlterTable -ALTER TABLE "hospital_discounts" ALTER COLUMN "created_at" SET DEFAULT CURRENT_TIMESTAMP; - --- DropTable -DROP TABLE "hospital_specialty_master"; - --- CreateTable -CREATE TABLE "hospital_speciality_master" ( - "id" UUID NOT NULL, - "name" TEXT NOT NULL, - "is_active" BOOLEAN NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "hospital_speciality_master_pkey" PRIMARY KEY ("id") -); - --- AddForeignKey -ALTER TABLE "hospital_specialities" ADD CONSTRAINT "hospital_specialities_speciality_id_fkey" FOREIGN KEY ("speciality_id") REFERENCES "hospital_speciality_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/migration_lock.toml b/prisma/migrations/migration_lock.toml deleted file mode 100644 index 044d57c..0000000 --- a/prisma/migrations/migration_lock.toml +++ /dev/null @@ -1,3 +0,0 @@ -# Please do not edit this file manually -# It should be added in your version-control system (e.g., Git) -provider = "postgresql" -- GitLab