mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Ignore bookmarks.topic_id column and remove references to it in code (#14289)
We don't need no stinkin' denormalization! This commit ignores the topic_id column on bookmarks, to be deleted at a later date. We don't really need this column and it's better to rely on the post.topic_id as the canonical topic_id for bookmarks, then we don't need to remember to update both columns if the bookmarked post moves to another topic.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class MakeTopicIdNullableForBookmarks < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
change_column_null :bookmarks, :topic_id, true
|
||||
Migration::ColumnDropper.mark_readonly(:bookmarks, :topic_id)
|
||||
end
|
||||
|
||||
def down
|
||||
Migration::ColumnDropper.drop_readonly(:bookmarks, :topic_id)
|
||||
change_column_null :bookmarks, :topic_id, false
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user