-- Add missing columns to Dealer table
ALTER TABLE "Dealer" ADD COLUMN "domainPrefix" TEXT NOT NULL DEFAULT 'myamsoil';
ALTER TABLE "Dealer" ADD COLUMN "customDomain" TEXT;
ALTER TABLE "Dealer" ADD COLUMN "dealerNumber" TEXT;

-- Make subdomain nullable (was required before)
ALTER TABLE "Dealer" ALTER COLUMN "subdomain" DROP NOT NULL;

-- Add unique constraint on customDomain
CREATE UNIQUE INDEX "Dealer_customDomain_key" ON "Dealer"("customDomain");
