This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
CREATE TABLE "launcher_manual_documents" (
|
||||
"id" UUID NOT NULL,
|
||||
"key" TEXT NOT NULL,
|
||||
"title" TEXT NOT NULL,
|
||||
"body" TEXT NOT NULL,
|
||||
"is_published" BOOLEAN NOT NULL DEFAULT true,
|
||||
"sort_order" INTEGER NOT NULL DEFAULT 0,
|
||||
"created_at" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "launcher_manual_documents_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX "launcher_manual_documents_key_key" ON "launcher_manual_documents"("key");
|
||||
CREATE INDEX "launcher_manual_documents_is_published_sort_order_idx" ON "launcher_manual_documents"("is_published", "sort_order");
|
||||
@@ -0,0 +1,6 @@
|
||||
ALTER TABLE "launcher_manual_documents"
|
||||
ADD COLUMN "app_key" TEXT NOT NULL DEFAULT 'Launcher';
|
||||
|
||||
DROP INDEX IF EXISTS "launcher_manual_documents_is_published_sort_order_idx";
|
||||
CREATE INDEX "launcher_manual_documents_app_key_is_published_sort_order_idx"
|
||||
ON "launcher_manual_documents"("app_key", "is_published", "sort_order");
|
||||
@@ -0,0 +1,2 @@
|
||||
DROP INDEX IF EXISTS "launcher_manual_documents_key_key";
|
||||
ALTER TABLE "launcher_manual_documents" DROP COLUMN IF EXISTS "key";
|
||||
@@ -0,0 +1,7 @@
|
||||
ALTER TABLE "launcher_manual_documents"
|
||||
ADD COLUMN IF NOT EXISTS "created_by_id" UUID,
|
||||
ADD COLUMN IF NOT EXISTS "created_by_name" TEXT,
|
||||
ADD COLUMN IF NOT EXISTS "created_by_email" TEXT;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "launcher_manual_documents_created_by_email_idx"
|
||||
ON "launcher_manual_documents"("created_by_email");
|
||||
@@ -0,0 +1,9 @@
|
||||
DO $$
|
||||
BEGIN
|
||||
IF to_regclass('public.organizations') IS NOT NULL THEN
|
||||
ALTER TABLE "organizations"
|
||||
ADD COLUMN IF NOT EXISTS "created_by_id" UUID,
|
||||
ADD COLUMN IF NOT EXISTS "created_by_name" TEXT,
|
||||
ADD COLUMN IF NOT EXISTS "created_by_email" TEXT;
|
||||
END IF;
|
||||
END $$;
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
ALTER TABLE "organizations"
|
||||
ADD COLUMN "instructor_invite_code" TEXT;
|
||||
|
||||
UPDATE "organizations"
|
||||
SET "instructor_invite_code" = UPPER(SUBSTRING(MD5("id"::text || CLOCK_TIMESTAMP()::text) FROM 1 FOR 6))
|
||||
WHERE "instructor_invite_code" IS NULL;
|
||||
|
||||
ALTER TABLE "organizations"
|
||||
ALTER COLUMN "instructor_invite_code" SET NOT NULL;
|
||||
|
||||
CREATE UNIQUE INDEX "organizations_instructor_invite_code_key"
|
||||
ON "organizations"("instructor_invite_code");
|
||||
Reference in New Issue
Block a user