diff --git a/prisma/migrations/20251102030623_/migration.sql b/prisma/migrations/20251102030623_/migration.sql new file mode 100644 index 0000000..3b058d5 --- /dev/null +++ b/prisma/migrations/20251102030623_/migration.sql @@ -0,0 +1,43 @@ +/* + Warnings: + + - You are about to drop the column `requiresApproval` on the `boards` table. All the data in the column will be lost. + - You are about to drop the column `type` on the `boards` table. All the data in the column will be lost. + +*/ +-- RedefineTables +PRAGMA defer_foreign_keys=ON; +PRAGMA foreign_keys=OFF; +CREATE TABLE "new_boards" ( + "id" TEXT NOT NULL PRIMARY KEY, + "name" TEXT NOT NULL, + "slug" TEXT NOT NULL, + "description" TEXT, + "sortOrder" INTEGER NOT NULL DEFAULT 0, + "status" TEXT NOT NULL DEFAULT 'active', + "allowAnonymousPost" BOOLEAN NOT NULL DEFAULT false, + "allowSecretComment" BOOLEAN NOT NULL DEFAULT false, + "isAdultOnly" BOOLEAN NOT NULL DEFAULT false, + "requiredTags" JSONB, + "requiredFields" JSONB, + "readLevel" TEXT NOT NULL DEFAULT 'public', + "writeLevel" TEXT NOT NULL DEFAULT 'member', + "categoryId" TEXT, + "mainPageViewTypeId" TEXT, + "listViewTypeId" TEXT, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" DATETIME NOT NULL, + CONSTRAINT "boards_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "board_categories" ("id") ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT "boards_mainPageViewTypeId_fkey" FOREIGN KEY ("mainPageViewTypeId") REFERENCES "board_view_types" ("id") ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT "boards_listViewTypeId_fkey" FOREIGN KEY ("listViewTypeId") REFERENCES "board_view_types" ("id") ON DELETE SET NULL ON UPDATE CASCADE +); +INSERT INTO "new_boards" ("allowAnonymousPost", "allowSecretComment", "categoryId", "createdAt", "description", "id", "isAdultOnly", "listViewTypeId", "mainPageViewTypeId", "name", "readLevel", "requiredFields", "requiredTags", "slug", "sortOrder", "status", "updatedAt", "writeLevel") SELECT "allowAnonymousPost", "allowSecretComment", "categoryId", "createdAt", "description", "id", "isAdultOnly", "listViewTypeId", "mainPageViewTypeId", "name", "readLevel", "requiredFields", "requiredTags", "slug", "sortOrder", "status", "updatedAt", "writeLevel" FROM "boards"; +DROP TABLE "boards"; +ALTER TABLE "new_boards" RENAME TO "boards"; +CREATE UNIQUE INDEX "boards_slug_key" ON "boards"("slug"); +CREATE INDEX "boards_status_sortOrder_idx" ON "boards"("status", "sortOrder"); +CREATE INDEX "boards_categoryId_idx" ON "boards"("categoryId"); +CREATE INDEX "boards_mainPageViewTypeId_idx" ON "boards"("mainPageViewTypeId"); +CREATE INDEX "boards_listViewTypeId_idx" ON "boards"("listViewTypeId"); +PRAGMA foreign_keys=ON; +PRAGMA defer_foreign_keys=OFF; diff --git a/src/app/components/AppHeader.tsx b/src/app/components/AppHeader.tsx index 845af95..7e8a53f 100644 --- a/src/app/components/AppHeader.tsx +++ b/src/app/components/AppHeader.tsx @@ -401,6 +401,13 @@ export function AppHeader() {