Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CST - Added db migration to update evidence_submissions fields from type string to integer #20490

Merged
merged 4 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class ChangeDataTypesForEvidenceSubmissions < ActiveRecord::Migration[7.2]
# Change request_id from a string to an integer
# Change claim_id from a string to an integer
# Change tracked_item_id from a string to an integer

def change
safety_assured do
reversible do |direction|
change_table :evidence_submissions do |t|
direction.up do
EvidenceSubmission.where(tracked_item_id: '[nil]').update_all(tracked_item_id: nil)
change_column :evidence_submissions, :request_id, :integer, using: 'request_id::integer'
change_column :evidence_submissions, :claim_id, :integer, using: 'claim_id::integer'
change_column :evidence_submissions, :tracked_item_id, :integer, using: 'tracked_item_id::integer'
end
direction.down do
change_column :evidence_submissions, :request_id, :string
change_column :evidence_submissions, :claim_id, :string
change_column :evidence_submissions, :tracked_item_id, :string
end
end
end
end
end
end
8 changes: 4 additions & 4 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading