ALTER TABLE "Account"
ADD COLUMN "householdId" TEXT,
ADD COLUMN "ownerUserId" TEXT,
ADD COLUMN "ownershipType" TEXT NOT NULL DEFAULT 'mine';

CREATE INDEX "Account_householdId_ownershipType_idx" ON "Account"("householdId", "ownershipType");
CREATE INDEX "Account_ownerUserId_idx" ON "Account"("ownerUserId");

ALTER TABLE "Account" ADD CONSTRAINT "Account_householdId_fkey" FOREIGN KEY ("householdId") REFERENCES "Household"("id") ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE "Account" ADD CONSTRAINT "Account_ownerUserId_fkey" FOREIGN KEY ("ownerUserId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
