diff --git a/migrations/cockroach/V1.37__current_sequence_table.sql b/migrations/cockroach/V1.37__current_sequence_table.sql index 860b0a8622..875713dab2 100644 --- a/migrations/cockroach/V1.37__current_sequence_table.sql +++ b/migrations/cockroach/V1.37__current_sequence_table.sql @@ -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; \ No newline at end of file diff --git a/migrations/cockroach/V1.38__reset_login_policies.sql b/migrations/cockroach/V1.38__reset_login_policies.sql new file mode 100644 index 0000000000..0e4055d436 --- /dev/null +++ b/migrations/cockroach/V1.38__reset_login_policies.sql @@ -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; \ No newline at end of file