feat: migrate to site-settings
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the `Banner` table. If the table is not empty, all the data it contains will be lost.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Banner" DROP CONSTRAINT "Banner_userId_fkey";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Banner";
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "SiteSettings" (
|
||||
"id" TEXT NOT NULL,
|
||||
"enabled" BOOLEAN NOT NULL DEFAULT false,
|
||||
"data" JSONB NOT NULL,
|
||||
"lastModifiedByUserId" INTEGER,
|
||||
"lastModifiedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "SiteSettings_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "SiteSettings" ADD CONSTRAINT "SiteSettings_lastModifiedByUserId_fkey" FOREIGN KEY ("lastModifiedByUserId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,13 @@
|
||||
INSERT INTO "SiteSettings" ("id", "enabled", "data")
|
||||
VALUES (
|
||||
'site.banner',
|
||||
FALSE,
|
||||
jsonb_build_object(
|
||||
'content',
|
||||
'This is a test banner',
|
||||
'bgColor',
|
||||
'#000000',
|
||||
'textColor',
|
||||
'#ffffff'
|
||||
)
|
||||
);
|
||||
Reference in New Issue
Block a user