44 lines
2.5 KiB
MySQL
44 lines
2.5 KiB
MySQL
|
|
/*
|
||
|
|
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;
|