29 lines
1.1 KiB
SQL
29 lines
1.1 KiB
SQL
DO $$
|
|
BEGIN
|
|
IF to_regclass('public.launcher_notices') IS NOT NULL THEN
|
|
CREATE TABLE IF NOT EXISTS "launcher_terms" (
|
|
"id" UUID NOT NULL,
|
|
"key" TEXT NOT NULL,
|
|
"body" TEXT NOT NULL,
|
|
"is_required" BOOLEAN NOT NULL DEFAULT true,
|
|
"created_by_id" UUID,
|
|
"created_by_name" TEXT,
|
|
"created_by_email" TEXT,
|
|
"created_at" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"updated_at" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
CONSTRAINT "launcher_terms_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS "launcher_terms_key_key" ON "launcher_terms"("key");
|
|
CREATE INDEX IF NOT EXISTS "launcher_terms_created_by_email_idx" ON "launcher_terms"("created_by_email");
|
|
|
|
ALTER TABLE "launcher_terms" DROP COLUMN IF EXISTS "title";
|
|
ALTER TABLE "launcher_terms" DROP COLUMN IF EXISTS "priority";
|
|
ALTER TABLE "launcher_terms" DROP COLUMN IF EXISTS "version";
|
|
ALTER TABLE "launcher_terms" DROP COLUMN IF EXISTS "is_active";
|
|
ALTER TABLE "launcher_terms" DROP COLUMN IF EXISTS "starts_at";
|
|
ALTER TABLE "launcher_terms" DROP COLUMN IF EXISTS "ends_at";
|
|
END IF;
|
|
END $$;
|