diff --git a/prisma/migrations/20260802232754_add_vendor/migration.sql b/prisma/migrations/20260802232754_add_vendor/migration.sql new file mode 100644 index 0000000..b30f4f5 --- /dev/null +++ b/prisma/migrations/20260802232754_add_vendor/migration.sql @@ -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") +); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 63c54fa..02d35a0 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -122,6 +122,28 @@ model License { @@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, // see CLAUDE.md / auth decision notes). A handful of trusted IT staff // accounts, created by hand via scripts/create-user.ts, no self-registration.