mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-29 15:38:52 +00:00
Prevent failure in setup step 69 if cache.objects does not exist (#11673)
# Which Problems Are Solved If the `cache.objects`-table does not exist setup failes with the following error: `ERROR: relation "cache.objects" does not exist at character 44` # How the Problems Are Solved Changed statement to prevent immediately throw an error if the table is missing. # Additional Context - reported in https://discord.com/channels/927474939156643850/1473769282880934089 - backport to v4
This commit is contained in:
+5
-9
@@ -2,16 +2,8 @@ DO
|
|||||||
$do$
|
$do$
|
||||||
BEGIN
|
BEGIN
|
||||||
-- Convert objects to logged first (if unlogged)
|
-- Convert objects to logged first (if unlogged)
|
||||||
IF EXISTS (SELECT 1 FROM pg_class WHERE oid = 'cache.objects'::REGCLASS AND relpersistence = 'u') THEN
|
|
||||||
ALTER TABLE IF EXISTS cache.objects
|
|
||||||
SET LOGGED;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Convert string_keys to logged (if unlogged)
|
|
||||||
-- Drop the FK constraint first to allow converting cache.string_keys (and avoid loggedness-change restrictions involving the FK)
|
|
||||||
IF EXISTS (SELECT 1 FROM pg_class WHERE oid = to_regclass('cache.objects') AND relpersistence = 'u') THEN
|
IF EXISTS (SELECT 1 FROM pg_class WHERE oid = to_regclass('cache.objects') AND relpersistence = 'u') THEN
|
||||||
ALTER TABLE IF EXISTS cache.objects
|
ALTER TABLE IF EXISTS cache.objects SET LOGGED;
|
||||||
SET LOGGED;
|
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- Convert string_keys to logged (if unlogged)
|
-- Convert string_keys to logged (if unlogged)
|
||||||
@@ -28,10 +20,14 @@ BEGIN
|
|||||||
ON DELETE CASCADE;
|
ON DELETE CASCADE;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
IF to_regclass('cache.objects') IS NOT NULL THEN
|
||||||
CREATE UNLOGGED TABLE IF NOT EXISTS cache.objects_default
|
CREATE UNLOGGED TABLE IF NOT EXISTS cache.objects_default
|
||||||
PARTITION OF cache.objects DEFAULT;
|
PARTITION OF cache.objects DEFAULT;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF to_regclass('cache.string_keys') IS NOT NULL THEN
|
||||||
CREATE UNLOGGED TABLE IF NOT EXISTS cache.string_keys_default
|
CREATE UNLOGGED TABLE IF NOT EXISTS cache.string_keys_default
|
||||||
PARTITION OF cache.string_keys DEFAULT;
|
PARTITION OF cache.string_keys DEFAULT;
|
||||||
|
END IF;
|
||||||
END
|
END
|
||||||
$do$
|
$do$
|
||||||
|
|||||||
Reference in New Issue
Block a user