From ae7ee51b9d8cc5d77f165fd69d89b41765d42912 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Wed, 25 Feb 2026 14:36:53 -0800 Subject: [PATCH] fix db migrations --- .../migrations/0005_controller_log_and_sso.down.sql | 1 - .../migrations/0005_controller_log_and_sso.up.sql | 11 ----------- .../migrations/0006_oidc_config.down.sql | 2 ++ .../migrations/0006_oidc_config.up.sql | 13 +++++++++++++ 4 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 ext/central-controller-docker/migrations/0006_oidc_config.down.sql create mode 100644 ext/central-controller-docker/migrations/0006_oidc_config.up.sql diff --git a/ext/central-controller-docker/migrations/0005_controller_log_and_sso.down.sql b/ext/central-controller-docker/migrations/0005_controller_log_and_sso.down.sql index 86a2f1ff6..3327b86ac 100644 --- a/ext/central-controller-docker/migrations/0005_controller_log_and_sso.down.sql +++ b/ext/central-controller-docker/migrations/0005_controller_log_and_sso.down.sql @@ -3,4 +3,3 @@ DROP INDEX IF EXISTS ctl_id_ix; DROP TABLE IF EXISTS controller_log; DROP INDEX IF EXISTS sso_expiry_network_member_ix; DROP TABLE IF EXISTS sso_expiry; -DROP TABLE IF EXISTS oidc_config; \ No newline at end of file diff --git a/ext/central-controller-docker/migrations/0005_controller_log_and_sso.up.sql b/ext/central-controller-docker/migrations/0005_controller_log_and_sso.up.sql index ca1776ac9..c9f4ac22d 100644 --- a/ext/central-controller-docker/migrations/0005_controller_log_and_sso.up.sql +++ b/ext/central-controller-docker/migrations/0005_controller_log_and_sso.up.sql @@ -17,14 +17,3 @@ CREATE TABLE IF NOT EXISTS sso_expiry ( authentication_expiry_time TIMESTAMP WITH TIME ZONE, FOREIGN KEY (network_id, device_id) REFERENCES network_memberships_ctl(network_id, device_id) ON DELETE CASCADE ); -CREATE INDEX IF NOT EXISTS sso_expiry_network_member_ix ON public.sso_expiry (network_id, device_id); - -CREATE TABLE IF NOT EXISTS oidc_config ( - client_id TEXT NOT NULL, - linked_id TEXT NOT NULL, - issuer TEXT NOT NULL, - authorization_endpoint TEXT NOT NULL, - sso_impl_version BIGINT NOT NULL DEFAULT 1, - provider TEXT NOT NULL DEFAULT 'default', - PRIMARY KEY (client_id, linked_id) -); \ No newline at end of file diff --git a/ext/central-controller-docker/migrations/0006_oidc_config.down.sql b/ext/central-controller-docker/migrations/0006_oidc_config.down.sql new file mode 100644 index 000000000..e65d94c80 --- /dev/null +++ b/ext/central-controller-docker/migrations/0006_oidc_config.down.sql @@ -0,0 +1,2 @@ +DROP TABLE IF EXISTS oidc_config; +ALTER TABLE sso_expiry RENAME COLUMN device_id TO member_id; \ No newline at end of file diff --git a/ext/central-controller-docker/migrations/0006_oidc_config.up.sql b/ext/central-controller-docker/migrations/0006_oidc_config.up.sql new file mode 100644 index 000000000..d86a0a258 --- /dev/null +++ b/ext/central-controller-docker/migrations/0006_oidc_config.up.sql @@ -0,0 +1,13 @@ +CREATE INDEX IF NOT EXISTS sso_expiry_network_member_ix ON public.sso_expiry (network_id, device_id); + +ALTER TABLE sso_expiry RENAME COLUMN member_id TO device_id; + +CREATE TABLE IF NOT EXISTS oidc_config ( + client_id TEXT NOT NULL, + linked_id TEXT NOT NULL, + issuer TEXT NOT NULL, + authorization_endpoint TEXT NOT NULL, + sso_impl_version BIGINT NOT NULL DEFAULT 1, + provider TEXT NOT NULL DEFAULT 'default', + PRIMARY KEY (client_id, linked_id) +); \ No newline at end of file