procbay-schema 1.0.21 → 1.0.22

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.21",
3
+ "version": "1.0.22",
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,8 @@
1
+ -- AlterTable
2
+ ALTER TABLE "export_logs" ALTER COLUMN "expires_at" SET DEFAULT NOW() + INTERVAL '7 days';
3
+
4
+ -- AlterTable
5
+ ALTER TABLE "item" ADD COLUMN "sub_category_id" INTEGER;
6
+
7
+ -- AddForeignKey
8
+ ALTER TABLE "item" ADD CONSTRAINT "item_sub_category_id_fkey" FOREIGN KEY ("sub_category_id") REFERENCES "categories"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -238,25 +238,26 @@ model UserDepartment {
238
238
 
239
239
  //---------------------------------- CATEGORY MODEL START ----------------------------------
240
240
  model Category {
241
- id Int @id @default(autoincrement())
242
- uuid String? @unique @default(uuid())
243
- name String? @unique
244
- slug String?
245
- is_active Boolean @default(true)
246
- parent_id Int @default(0)
247
- description String?
248
- image_url String?
249
- created_by Int?
250
- created_at DateTime @default(now()) @db.Timestamptz(6)
251
- updated_by Int?
252
- updated_at DateTime @updatedAt @db.Timestamptz(6)
253
- is_deleted Boolean @default(false)
254
- deleted_by Int?
255
- deleted_at DateTime? @db.Timestamptz(6)
256
- attributes Attribute[]
257
- Item Item[]
258
- category_uom UomCategory[]
259
- category_budget CategoryBudget[]
241
+ id Int @id @default(autoincrement())
242
+ uuid String? @unique @default(uuid())
243
+ name String? @unique
244
+ slug String?
245
+ is_active Boolean @default(true)
246
+ parent_id Int @default(0)
247
+ description String?
248
+ image_url String?
249
+ created_by Int?
250
+ created_at DateTime @default(now()) @db.Timestamptz(6)
251
+ updated_by Int?
252
+ updated_at DateTime @updatedAt @db.Timestamptz(6)
253
+ is_deleted Boolean @default(false)
254
+ deleted_by Int?
255
+ deleted_at DateTime? @db.Timestamptz(6)
256
+ attributes Attribute[]
257
+ category_uom UomCategory[]
258
+ category_budget CategoryBudget[]
259
+ item_category Item[] @relation("ItemCategory")
260
+ item_sub_category Item[] @relation("ItemSubCategory")
260
261
 
261
262
  @@map("categories")
262
263
  }
@@ -320,7 +321,9 @@ model Item {
320
321
  is_parent Boolean @default(false)
321
322
  parent_id Int? @default(0)
322
323
  category_id Int?
323
- category Category? @relation(fields: [category_id], references: [id])
324
+ category Category? @relation("ItemCategory", fields: [category_id], references: [id])
325
+ sub_category_id Int?
326
+ sub_category Category? @relation("ItemSubCategory", fields: [sub_category_id], references: [id])
324
327
  uomId Int?
325
328
  uom Uom? @relation(fields: [uomId], references: [id])
326
329
  item_code String? @unique