procbay-schema 1.0.13 → 1.0.14

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.13",
3
+ "version": "1.0.14",
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",
File without changes
@@ -0,0 +1,30 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the column `createdAt` on the `expenses` table. All the data in the column will be lost.
5
+ - You are about to drop the column `updatedAt` on the `expenses` table. All the data in the column will be lost.
6
+ - A unique constraint covering the columns `[code]` on the table `budgets` will be added. If there are existing duplicate values, this will fail.
7
+ - A unique constraint covering the columns `[code,fiscal_year]` on the table `budgets` will be added. If there are existing duplicate values, this will fail.
8
+ - Added the required column `updated_at` to the `expenses` table without a default value. This is not possible if the table is not empty.
9
+
10
+ */
11
+ -- AlterTable
12
+ ALTER TABLE "budgets" ADD COLUMN "code" TEXT;
13
+
14
+ -- AlterTable
15
+ ALTER TABLE "category_budgets" ADD COLUMN "fiscal_year" TEXT;
16
+
17
+ -- AlterTable
18
+ ALTER TABLE "expenses" DROP COLUMN "createdAt",
19
+ DROP COLUMN "updatedAt",
20
+ ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
21
+ ADD COLUMN "updated_at" TIMESTAMP(3) NOT NULL;
22
+
23
+ -- AlterTable
24
+ ALTER TABLE "export_logs" ALTER COLUMN "expires_at" SET DEFAULT NOW() + INTERVAL '7 days';
25
+
26
+ -- CreateIndex
27
+ CREATE UNIQUE INDEX "budgets_code_key" ON "budgets"("code");
28
+
29
+ -- CreateIndex
30
+ CREATE UNIQUE INDEX "budgets_code_fiscal_year_key" ON "budgets"("code", "fiscal_year");
@@ -2222,7 +2222,7 @@ model UserEventConfiguration {
2222
2222
 
2223
2223
  //------------------------------------- USER EVENT CONFIGURATION MODEL END --------------------------------------------
2224
2224
 
2225
- //------------------------------------- EXPORT MODEL START --------------------------------------------
2225
+ //------------------------------------- EXPORT MODEL START ------------------------------------------------------------
2226
2226
 
2227
2227
  enum ExportStatus {
2228
2228
  PENDING
@@ -2262,7 +2262,7 @@ model ExportLog {
2262
2262
  @@map("export_logs")
2263
2263
  }
2264
2264
 
2265
- //------------------------------------- UPLOAD MODEL END --------------------------------------------
2265
+ //------------------------------------- UPLOAD MODEL END ---------------------------------------------------
2266
2266
 
2267
2267
  //------------------------------------- FISCAL YEAR MODEL START --------------------------------------------
2268
2268
 
@@ -2288,7 +2288,7 @@ model FiscalYear {
2288
2288
 
2289
2289
  //------------------------------------- FISCAL YEAR MODEL END --------------------------------------------
2290
2290
 
2291
- //------------------------------------- BUDGET MODEL START --------------------------------------------
2291
+ //------------------------------------- BUDGET MODEL START -----------------------------------------------
2292
2292
  enum BudgetStatus {
2293
2293
  WARNING
2294
2294
  HEALTHY
@@ -2298,6 +2298,7 @@ enum BudgetStatus {
2298
2298
  model Budget {
2299
2299
  id Int @id @default(autoincrement())
2300
2300
  uuid String? @unique @default(uuid())
2301
+ code String? @unique // Unique code for the budget
2301
2302
  company_name String?
2302
2303
  fiscal_year String?
2303
2304
  currency String? @default("INR")
@@ -2316,10 +2317,11 @@ model Budget {
2316
2317
  department_budgets DepartmentBudget[]
2317
2318
  supporting_documents SupportingDocument[]
2318
2319
 
2320
+ @@unique([code, fiscal_year], name: "unique_budget_code_fiscal_year")
2319
2321
  @@map("budgets")
2320
2322
  }
2321
2323
 
2322
- //------------------------------------- BUDGET MODEL END --------------------------------------------
2324
+ //------------------------------------- BUDGET MODEL END ---------------------------------------------------------
2323
2325
 
2324
2326
  //------------------------------------- DEPARTMENT BUDGET MODEL START --------------------------------------------
2325
2327
  model DepartmentBudget {
@@ -2359,6 +2361,7 @@ model CategoryBudget {
2359
2361
  department_budget_id Int?
2360
2362
  category_id Int?
2361
2363
  allocated_budget Decimal @db.Decimal(15, 2)
2364
+ fiscal_year String? // e.g., "FY 2025-26"
2362
2365
  notes String?
2363
2366
  description String?
2364
2367
  crated_by Int?
@@ -2379,7 +2382,8 @@ model CategoryBudget {
2379
2382
  @@map("category_budgets")
2380
2383
  }
2381
2384
 
2382
- //------------------------------------- CATEGORY BUDGET MODEL END --------------------------------------------
2385
+ //------------------------------------- CATEGORY BUDGET MODEL END --------------------------------------------------
2386
+
2383
2387
  //------------------------------------- SUPPORTING DOCUMENT MODEL START --------------------------------------------
2384
2388
 
2385
2389
  model SupportingDocument {
@@ -2410,7 +2414,8 @@ model SupportingDocument {
2410
2414
  }
2411
2415
 
2412
2416
  //------------------------------------- SUPPORTING DOCUMENT MODEL END --------------------------------------------
2413
- //------------------------------------- EXPENSE MODEL START --------------------------------------------
2417
+
2418
+ //------------------------------------- EXPENSE MODEL START ------------------------------------------------------
2414
2419
 
2415
2420
  // For tracking actual expenses against budgets
2416
2421
  model Expense {
@@ -2423,8 +2428,8 @@ model Expense {
2423
2428
  receipt_number String?
2424
2429
  vendor_name String?
2425
2430
  notes String?
2426
- createdAt DateTime @default(now())
2427
- updatedAt DateTime @updatedAt
2431
+ created_at DateTime @default(now())
2432
+ updated_at DateTime @updatedAt
2428
2433
 
2429
2434
  // Relations
2430
2435
  category_budget CategoryBudget? @relation(fields: [category_budget_id], references: [id], onDelete: Cascade)
@@ -2432,7 +2437,7 @@ model Expense {
2432
2437
  @@map("expenses")
2433
2438
  }
2434
2439
 
2435
- //------------------------------------- EXPENSE MODEL END ----------------------------------------------
2440
+ //------------------------------------- EXPENSE MODEL END -----------------------------------------------------
2436
2441
 
2437
2442
  //------------------------------------- VENDOR REFERENCE MODEL START ------------------------------------------
2438
2443
 
@@ -2455,7 +2460,7 @@ model VendorReference {
2455
2460
  @@map("vendor_references")
2456
2461
  }
2457
2462
 
2458
- //------------------------------------- VENDOR REFERENCE MODEL END --------------------------------------------
2463
+ //------------------------------------- VENDOR REFERENCE MODEL END ----------------------------------------------
2459
2464
 
2460
2465
  //------------------------------------- FAST CATALOGUE MODEL START ----------------------------------------------
2461
2466
 
@@ -2482,7 +2487,7 @@ model RequestedCatalogue {
2482
2487
  @@map("requested_catalogues")
2483
2488
  }
2484
2489
 
2485
- //------------------------------------- FAST CATALOGUE MODEL END ----------------------------------------------
2490
+ //------------------------------------- FAST CATALOGUE MODEL END ------------------------------------------------------
2486
2491
 
2487
2492
  //------------------------------------- FAST CATALOGUE ITEMS MODEL START ----------------------------------------------
2488
2493
 
@@ -2512,7 +2517,8 @@ model RequestedCatalogueItem {
2512
2517
  @@map("requested_catalogue_items")
2513
2518
  }
2514
2519
 
2515
- //------------------------------------- FAST CATALOGUE ITEMS MODEL END ----------------------------------------------
2520
+ //------------------------------------- FAST CATALOGUE ITEMS MODEL END --------------------------------------------------
2521
+
2516
2522
  //------------------------------------- FAST CATALOGUE VENDORS MODEL START ----------------------------------------------
2517
2523
 
2518
2524
  enum RequestedCatalogueVendorStatusEnum {