このコミットが含まれているのは:
2025-10-13 01:57:10 +09:00
コミット 14f67b02e2
9個のファイルの変更171行の追加54行の削除
+18
ファイルの表示
@@ -0,0 +1,18 @@
class AddDiscardToPostTags < ActiveRecord::Migration[8.0]
def change
add_column :post_tags, :discarded_at, :datetime
add_index :post_tags, :discarded_at
add_column :post_tags, :is_active, :boolean,
as: 'discarded_at IS NULL', stored: true
add_column :post_tags, :active_unique_key, :string,
as: "CASE WHEN discarded_at IS NULL THEN CONCAT(post_id, ':', tag_id) ELSE NULL END",
stored: true
add_index :post_tags, :active_unique_key, unique: true, name: 'idx_post_tags_active_unique'
add_index :post_tags, [:post_id, :discarded_at]
add_index :post_tags, [:tag_id, :discarded_at]
end
end