procbay-schema 1.0.26 → 1.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "procbay-schema",
3
- "version": "1.0.26",
3
+ "version": "1.0.27",
4
4
  "description": "A set of utilities for managing Prisma database schemas, seeding, and maintenance operations for the Procure-to-Pay system",
5
5
  "main": "src/prisma/index.js",
6
6
  "type": "module",
@@ -0,0 +1,12 @@
1
+ -- AlterTable
2
+ ALTER TABLE "catalogue_vendor" ADD COLUMN "item_id" INTEGER,
3
+ ADD COLUMN "variant_id" INTEGER;
4
+
5
+ -- AlterTable
6
+ ALTER TABLE "export_logs" ALTER COLUMN "expires_at" SET DEFAULT NOW() + INTERVAL '7 days';
7
+
8
+ -- AddForeignKey
9
+ ALTER TABLE "catalogue_vendor" ADD CONSTRAINT "catalogue_vendor_item_id_fkey" FOREIGN KEY ("item_id") REFERENCES "item"("id") ON DELETE CASCADE ON UPDATE CASCADE;
10
+
11
+ -- AddForeignKey
12
+ ALTER TABLE "catalogue_vendor" ADD CONSTRAINT "catalogue_vendor_variant_id_fkey" FOREIGN KEY ("variant_id") REFERENCES "item"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -390,8 +390,10 @@ model Item {
390
390
  purchase_order_items PurchaseOrderItem[]
391
391
  requested_catalogue_items RequestedCatalogueDetails[] @relation("ParentItemRequests")
392
392
  requested_catalogue_variants RequestedCatalogueDetails[] @relation("VariantItemRequests")
393
- catalogue_items Catalogue[] @relation("ParentItemRequests")
394
- catalogue_variants Catalogue[] @relation("VariantItemRequests")
393
+ catalogue_items Catalogue[] @relation("ParentItemCatalogue")
394
+ catalogue_variants Catalogue[] @relation("VariantItemCatalogue")
395
+ catalogue_vendor_items CatalogueVendor[] @relation("ParentItemCatalogueVendor")
396
+ catalogue_vendor_variants CatalogueVendor[] @relation("VariantItemCatalogueVendor")
395
397
 
396
398
  @@unique([item_handler, item_name])
397
399
  @@index([parent_id, is_active, is_deleted]) // For variant queries
@@ -2555,9 +2557,9 @@ model Catalogue {
2555
2557
  uuid String @unique @default(uuid())
2556
2558
  req_catalogue_id Int?
2557
2559
  item_id Int?
2558
- parent_item Item? @relation("ParentItemRequests", fields: [item_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
2560
+ parent_item Item? @relation("ParentItemCatalogue", fields: [item_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
2559
2561
  variant_id Int?
2560
- variant Item? @relation("VariantItemRequests", fields: [variant_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
2562
+ variant Item? @relation("VariantItemCatalogue", fields: [variant_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
2561
2563
  status CatalogueStatusEnum @default(ACTIVE)
2562
2564
  created_at DateTime? @default(now()) @db.Timestamptz(6)
2563
2565
  created_by Int?
@@ -2588,6 +2590,10 @@ model CatalogueVendor {
2588
2590
  uuid String @unique @default(uuid())
2589
2591
  catalogue_id Int?
2590
2592
  catalogue Catalogue? @relation(fields: [catalogue_id], references: [id], onDelete: Cascade)
2593
+ item_id Int?
2594
+ parent_item Item? @relation("ParentItemCatalogueVendor", fields: [item_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
2595
+ variant_id Int?
2596
+ variant Item? @relation("VariantItemCatalogueVendor", fields: [variant_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
2591
2597
  vendor_id Int?
2592
2598
  stock Int?
2593
2599
  price Decimal? @db.Decimal(15, 2)