fix: reset login_policy views (to ensure defaults) (#1605)

* fix: reset login_policy views (to ensure defaults)

* fix: migration 1.37
This commit is contained in:
Livio Amstutz 2021-04-17 17:23:37 +02:00 committed by GitHub
parent 7f8df6719f
commit b172cc2a82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 19 deletions

View File

@ -4,28 +4,14 @@ DELETE FROM authz.current_sequences WHERE aggregate_type <> '';
DELETE FROM adminapi.current_sequences WHERE aggregate_type <> '';
DELETE FROM notification.current_sequences WHERE aggregate_type <> '';
BEGIN;
ALTER TABLE management.current_sequences DROP CONSTRAINT "primary";
ALTER TABLE auth.current_sequences DROP CONSTRAINT "primary";
ALTER TABLE authz.current_sequences DROP CONSTRAINT "primary";
ALTER TABLE adminapi.current_sequences DROP CONSTRAINT "primary";
ALTER TABLE notification.current_sequences DROP CONSTRAINT "primary";
ALTER TABLE management.current_sequences ADD CONSTRAINT "primary" PRIMARY KEY (view_name);
ALTER TABLE auth.current_sequences ADD CONSTRAINT "primary" PRIMARY KEY (view_name);
ALTER TABLE authz.current_sequences ADD CONSTRAINT "primary" PRIMARY KEY (view_name);
ALTER TABLE adminapi.current_sequences ADD CONSTRAINT "primary" PRIMARY KEY (view_name);
ALTER TABLE notification.current_sequences ADD CONSTRAINT "primary" PRIMARY KEY (view_name);
COMMIT;
BEGIN;
ALTER TABLE management.current_sequences ALTER PRIMARY KEY USING COLUMNS(view_name);
ALTER TABLE auth.current_sequences ALTER PRIMARY KEY USING COLUMNS(view_name);
ALTER TABLE authz.current_sequences ALTER PRIMARY KEY USING COLUMNS(view_name);
ALTER TABLE adminapi.current_sequences ALTER PRIMARY KEY USING COLUMNS(view_name);
ALTER TABLE notification.current_sequences ALTER PRIMARY KEY USING COLUMNS(view_name);
ALTER TABLE management.current_sequences DROP COLUMN aggregate_type;
ALTER TABLE auth.current_sequences DROP COLUMN aggregate_type;
ALTER TABLE authz.current_sequences DROP COLUMN aggregate_type;
ALTER TABLE adminapi.current_sequences DROP COLUMN aggregate_type;
ALTER TABLE notification.current_sequences DROP COLUMN aggregate_type;
COMMIT;

View File

@ -0,0 +1,9 @@
BEGIN;
TRUNCATE auth.login_policies;
TRUNCATE management.login_policies;
UPDATE auth.current_sequences set current_sequence = 0 where view_name = 'auth.login_policies';
UPDATE management.current_sequences set current_sequence = 0 where view_name = 'management.login_policies';
COMMIT;