PERF: Remove foreign keys from bookmarks (#9837)

PERF: Remove foreign keys from bookmarks (#9837)

As a general rule we do not add FKs in Discourse and instead rely on consistency checks at weekly/daily intervals

diff --git a/db/post_migrate/20200520001619_remove_fks_from_bookmarks.rb b/db/post_migrate/20200520001619_remove_fks_from_bookmarks.rb
new file mode 100644
index 0000000..80fee6d
--- /dev/null
+++ b/db/post_migrate/20200520001619_remove_fks_from_bookmarks.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class RemoveFksFromBookmarks < ActiveRecord::Migration[6.0]
+  def change
+    remove_foreign_key :bookmarks, :topics
+    remove_foreign_key :bookmarks, :posts
+    remove_foreign_key :bookmarks, :users
+  end
+end

GitHub sha: e3341332

1 Like

This commit appears in #9837 which was merged by SamSaffron.