add default dates for upsert

This commit is contained in:
Kiara Grouwstra 2023-01-27 12:39:54 +01:00
parent 0946cb124c
commit db6a2e6ff1
1 changed files with 2 additions and 0 deletions

View File

@ -9,6 +9,8 @@ class CreateVotes < ActiveRecord::Migration[6.0]
t.timestamps
end
change_column_default :votes, :created_at, from: nil, to: ->{ 'now()' }
change_column_default :votes, :updated_at, from: nil, to: ->{ 'now()' }
add_index :votes, [:user_id, :election_slug], unique: true
end
end