lomavuokraus/prisma/migrations/20251212_agent_billing/migration.sql
2025-12-20 22:35:30 +02:00

19 lines
923 B
SQL

-- Agent billing preferences and per-listing overrides (legacy)
ALTER TABLE "User"
ADD COLUMN "agentBillingEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
ADD COLUMN "agentBankAccount" TEXT,
ADD COLUMN "agentVatBreakdownRequired" BOOLEAN NOT NULL DEFAULT FALSE,
ADD COLUMN "agentUseListingOverrides" BOOLEAN NOT NULL DEFAULT FALSE;
CREATE TABLE "ListingBillingSettings" (
"id" TEXT NOT NULL,
"listingId" TEXT NOT NULL,
"bankAccount" TEXT,
"vatBreakdownRequired" BOOLEAN NOT NULL DEFAULT FALSE,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "ListingBillingSettings_pkey" PRIMARY KEY ("id"),
CONSTRAINT "ListingBillingSettings_listingId_key" UNIQUE ("listingId"),
CONSTRAINT "ListingBillingSettings_listingId_fkey" FOREIGN KEY ("listingId") REFERENCES "Listing"("id") ON DELETE CASCADE ON UPDATE CASCADE
);