Skip to content

Commit

Permalink
Update migrations to support Rails upgrade (#23534)
Browse files Browse the repository at this point in the history
Co-authored-by: mounikamy <[email protected]>
  • Loading branch information
2 people authored and breedbah committed Nov 19, 2024
1 parent 69bc6c9 commit a4c72b9
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion db/migrate/20240507145931_add_columns_to_transcriptions.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class AddColumnsToTranscriptions < Caseflow::Migration
class AddColumnsToTranscriptions < ActiveRecord::Migration[6.1]
def change
add_column :transcriptions, :transcription_contractor_id, :bigint
add_column :transcriptions, :created_by_id, :bigint
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20240507203310_add_indexes_to_transcriptions.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class AddIndexesToTranscriptions < Caseflow::Migration
class AddIndexesToTranscriptions < ActiveRecord::Migration[6.1]
def change
add_safe_index :transcriptions, [:transcription_contractor_id], name: "index_transcriptions_on_transcription_contractor_id"
add_safe_index :transcriptions, [:deleted_at], name: "index_transcriptions_on_deleted_at"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class AddTranscriptionPackagesTable < Caseflow::Migration
class AddTranscriptionPackagesTable < ActiveRecord::Migration[6.1]
def change
create_table :transcription_packages do |t|
t.string :aws_link_zip, comment: "Link of where the file is in AWS S3 (transcription_text) for the return work order"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class UpdateTranscriptionPackagesColumns < Caseflow::Migration
class UpdateTranscriptionPackagesColumns < ActiveRecord::Migration[6.1]

def change
add_column :transcription_packages, :date_upload_box, :datetime, comment: "Date of successful delivery to box.com contractor endpoint"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddIndexToTranscriptionPackagesContractorId < ActiveRecord::Migration[6.1]
disable_ddl_transaction!
def change
add_index :transcription_packages, :contractor_id, name: "index_transcription_packages_on_contractor_id", algorithm: :concurrently
end
end
13 changes: 13 additions & 0 deletions db/migrate/20241118075353_update_indexes_on_transcriptions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class UpdateIndexesOnTranscriptions < ActiveRecord::Migration[6.1]
disable_ddl_transaction!

def change
unless index_exists?(:transcriptions, :transcription_contractor_id, name: "index_transcriptions_on_transcription_contractor_id")
add_index :transcriptions, :transcription_contractor_id, name: "index_transcriptions_on_transcription_contractor_id",algorithm: :concurrently
end

unless index_exists?(:transcriptions, :deleted_at, name: "index_transcriptions_on_deleted_at")
add_index :transcriptions, :deleted_at, name: "index_transcriptions_on_deleted_at",algorithm: :concurrently
end
end
end
7 changes: 4 additions & 3 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2024_10_12_181521) do
ActiveRecord::Schema.define(version: 2024_11_18_075353) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -1763,12 +1763,12 @@

create_table "returned_appeal_jobs", force: :cascade do |t|
t.datetime "completed_at"
t.datetime "created_at", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "errored_at"
t.text "returned_appeals", default: [], array: true
t.datetime "started_at"
t.json "stats"
t.datetime "updated_at", null: false
t.datetime "updated_at", precision: 6, null: false
end

create_table "schedule_periods", force: :cascade do |t|
Expand Down Expand Up @@ -2054,6 +2054,7 @@
t.string "task_number", comment: "Number associated with transcription, use as FK to transcriptions"
t.datetime "updated_at"
t.bigint "updated_by_id", comment: "The user who most recently updated the transcription file"
t.index ["contractor_id"], name: "index_transcription_packages_on_contractor_id"
t.index ["task_number"], name: "index_transcription_packages_on_task_number"
end

Expand Down

0 comments on commit a4c72b9

Please sign in to comment.