refactor: consolidate oidc_config and admin_thresholds into generic server_config table
All checks were successful
CI / build (push) Successful in 1m19s
CI / cleanup-branch (push) Has been skipped
CI / docker (push) Successful in 42s
CI / deploy (push) Has been skipped
CI / deploy-feature (push) Successful in 34s
CI / build (pull_request) Successful in 1m23s
CI / cleanup-branch (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / deploy (pull_request) Has been skipped
CI / deploy-feature (pull_request) Has been skipped
All checks were successful
CI / build (push) Successful in 1m19s
CI / cleanup-branch (push) Has been skipped
CI / docker (push) Successful in 42s
CI / deploy (push) Has been skipped
CI / deploy-feature (push) Successful in 34s
CI / build (pull_request) Successful in 1m23s
CI / cleanup-branch (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / deploy (pull_request) Has been skipped
CI / deploy-feature (pull_request) Has been skipped
Single JSONB key-value table replaces two singleton config tables, making future config types trivial to add. Also fixes pre-existing IT failures: Flyway URL not overridden by Testcontainers, threshold test ordering. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
-- =============================================================
|
||||
-- Consolidate oidc_config + admin_thresholds → server_config
|
||||
-- =============================================================
|
||||
|
||||
CREATE TABLE server_config (
|
||||
config_key TEXT PRIMARY KEY,
|
||||
config_val JSONB NOT NULL,
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_by TEXT
|
||||
);
|
||||
|
||||
-- Migrate existing oidc_config row (if any)
|
||||
INSERT INTO server_config (config_key, config_val, updated_at)
|
||||
SELECT 'oidc',
|
||||
jsonb_build_object(
|
||||
'enabled', enabled,
|
||||
'issuerUri', issuer_uri,
|
||||
'clientId', client_id,
|
||||
'clientSecret', client_secret,
|
||||
'rolesClaim', roles_claim,
|
||||
'defaultRoles', to_jsonb(default_roles),
|
||||
'autoSignup', auto_signup,
|
||||
'displayNameClaim', display_name_claim
|
||||
),
|
||||
updated_at
|
||||
FROM oidc_config
|
||||
WHERE config_id = 'default';
|
||||
|
||||
-- Migrate existing admin_thresholds row (if any)
|
||||
INSERT INTO server_config (config_key, config_val, updated_at, updated_by)
|
||||
SELECT 'thresholds', config, updated_at, updated_by
|
||||
FROM admin_thresholds
|
||||
WHERE id = 1;
|
||||
|
||||
DROP TABLE oidc_config;
|
||||
DROP TABLE admin_thresholds;
|
||||
Reference in New Issue
Block a user