Created
September 27, 2021 20:11
-
-
Save narath/90170c0bb402201462e0116b36f509d0 to your computer and use it in GitHub Desktop.
Rails Migration to add a default value to created_at and updated_at so COPY_FROM can work
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ChangeRawDiagnosesCreatedAtAndUpdatedAt < ActiveRecord::Migration[5.1] | |
def change | |
change_column_default :raw_diagnoses, :created_at, from: nil, to: -> { 'CURRENT_TIMESTAMP' } | |
change_column_default :raw_diagnoses, :updated_at, from: nil, to: -> { 'CURRENT_TIMESTAMP' } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment