votes: add is_deleted flag to post_votes table.
Add an is_deleted flag to post_votes so they can be soft-deleted in the future.
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
class AddIsDeletedToPostVotes < ActiveRecord::Migration[6.1]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
add_column :post_votes, :is_deleted, :boolean, default: false, null: :false
|
||||
add_index :post_votes, :is_deleted, where: "is_deleted = TRUE", algorithm: :concurrently
|
||||
add_index :post_votes, [:user_id, :post_id], unique: true, where: "is_deleted = FALSE", algorithm: :concurrently
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user