about summary refs log tree commit diff
path: root/db/post_migrate
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-08-28 13:27:17 +0200
committerGitHub <noreply@github.com>2022-08-28 13:27:17 +0200
commit215738bb3cba4951e84174b461da5f1004b0649e (patch)
treececa848b6a0553474e2b228dbf8c9e9c144cc99f /db/post_migrate
parent54d9a9c18a74a1ec766d8f611ad3ee11ab4c5422 (diff)
parent54ae7a221e862990550850500d70997c70187b70 (diff)
Merge pull request #1833 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'db/post_migrate')
-rw-r--r--db/post_migrate/20220729171123_fix_custom_filter_keywords_id_seq.rb20
-rw-r--r--db/post_migrate/20220824164532_remove_recorded_changes_from_admin_action_logs.rb9
2 files changed, 29 insertions, 0 deletions
diff --git a/db/post_migrate/20220729171123_fix_custom_filter_keywords_id_seq.rb b/db/post_migrate/20220729171123_fix_custom_filter_keywords_id_seq.rb
new file mode 100644
index 000000000..7ed34a3ef
--- /dev/null
+++ b/db/post_migrate/20220729171123_fix_custom_filter_keywords_id_seq.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class FixCustomFilterKeywordsIdSeq < ActiveRecord::Migration[6.1]
+  disable_ddl_transaction!
+
+  def up
+    # 20220613110711 manually inserts items with set `id` in the database, but
+    # we also need to bump the sequence number, otherwise 
+    safety_assured do
+      execute <<-SQL.squish
+        BEGIN;
+        LOCK TABLE custom_filter_keywords IN EXCLUSIVE MODE;
+        SELECT setval('custom_filter_keywords_id_seq'::regclass, id) FROM custom_filter_keywords ORDER BY id DESC LIMIT 1;
+        COMMIT;
+      SQL
+    end
+  end
+
+  def down; end
+end
diff --git a/db/post_migrate/20220824164532_remove_recorded_changes_from_admin_action_logs.rb b/db/post_migrate/20220824164532_remove_recorded_changes_from_admin_action_logs.rb
new file mode 100644
index 000000000..c42d5df8f
--- /dev/null
+++ b/db/post_migrate/20220824164532_remove_recorded_changes_from_admin_action_logs.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class RemoveRecordedChangesFromAdminActionLogs < ActiveRecord::Migration[5.2]
+  disable_ddl_transaction!
+
+  def change
+    safety_assured { remove_column :admin_action_logs, :recorded_changes, :text }
+  end
+end