change database table name organization to house

This commit is contained in:
2026-02-24 10:36:53 +07:00
parent 604fe0a80f
commit 1e6f4683ea
17 changed files with 1822 additions and 1786 deletions

View File

@@ -0,0 +1,36 @@
/*
Warnings:
- You are about to drop the `organization` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE "invitation" DROP CONSTRAINT "invitation_organizationId_fkey";
-- DropForeignKey
ALTER TABLE "member" DROP CONSTRAINT "member_organizationId_fkey";
-- DropTable
DROP TABLE "organization";
-- CreateTable
CREATE TABLE "house" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"slug" TEXT NOT NULL,
"logo" TEXT,
"createdAt" TIMESTAMPTZ NOT NULL,
"metadata" TEXT,
"color" TEXT DEFAULT '#000000',
CONSTRAINT "house_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "house_slug_key" ON "house"("slug");
-- AddForeignKey
ALTER TABLE "member" ADD CONSTRAINT "member_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "house"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "invitation" ADD CONSTRAINT "invitation_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "house"("id") ON DELETE CASCADE ON UPDATE CASCADE;