feat: add Vendor Prisma model + migration

This commit is contained in:
toanhoang
2026-08-02 19:28:09 -04:00
parent f325abf22c
commit 07ef1582d3
2 changed files with 35 additions and 0 deletions
@@ -0,0 +1,13 @@
-- CreateTable
CREATE TABLE "vendors" (
"id" UUID NOT NULL,
"name" TEXT NOT NULL,
"contact_email" TEXT NOT NULL,
"contact_phone" TEXT NOT NULL,
"address" TEXT NOT NULL,
"tax_code" TEXT,
"notes" TEXT,
"created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "vendors_pkey" PRIMARY KEY ("id")
);
+22
View File
@@ -122,6 +122,28 @@ model License {
@@map("licenses") @@map("licenses")
} }
// Purchasing counterparty — see docs/asset-license-management.md's "## Vendor
// (chốt 2026-08-02)". Deliberately independent of AssetModel.manufacturer
// (OEM, e.g. "Dell") — Vendor is the reseller/distributor actually bought
// from (e.g. "FPT Trading"), a different concept that isn't always the same
// company. No FKs on this entity yet: it's the starting point for later
// FKs from PurchaseOrder/License (License.vendor string -> License.vendorId
// FK retrofit is noted in the doc as a separate follow-up, not done here).
// taxCode/notes are nullable — not every vendor record has a known VN tax
// code or extra notes at creation time.
model Vendor {
id String @id @default(uuid()) @db.Uuid
name String
contactEmail String @map("contact_email")
contactPhone String @map("contact_phone")
address String
taxCode String? @map("tax_code")
notes String?
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
@@map("vendors")
}
// Minimal internal auth accounts — NOT company SSO (deliberately ruled out, // Minimal internal auth accounts — NOT company SSO (deliberately ruled out,
// see CLAUDE.md / auth decision notes). A handful of trusted IT staff // see CLAUDE.md / auth decision notes). A handful of trusted IT staff
// accounts, created by hand via scripts/create-user.ts, no self-registration. // accounts, created by hand via scripts/create-user.ts, no self-registration.