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

Edit EP Claim Labels | Add End Product Update model #15383

Merged
merged 11 commits into from Oct 8, 2020
21 changes: 12 additions & 9 deletions db/migrate/20201005190456_create_end_product_update.rb
@@ -1,19 +1,22 @@
class CreateEndProductUpdate < Caseflow::Migration[5.2]
class CreateEndProductUpdate < ActiveRecord::Migration[5.2]
Sjones352 marked this conversation as resolved.
Show resolved Hide resolved
nanotone marked this conversation as resolved.
Show resolved Hide resolved
disable_ddl_transaction!

def change
create_table :end_product_updates, comment: "Updates the claim label for end products established from Caseflow" do |t|
t.integer :user_id, comment: "The ID of the user who makes an end product update."
t.bigint :end_product_establishment_id, null: false, comment: "The end product establishment id used to track the end product being updated"
t.bigint :original_decision_review_id, null: false, comment: "The original ID of the decision review that this end product update belongs to; has a non-nil value only if a new decision_review was created."
t.string :original_decision_review_type, null: false, comment: "The original decision review type that this end product update belongs to"
t.string :status, null: false, comment: "Status after an attempt to update the end product; expected values: 'success', 'error', ..."
t.string :error, null: false, comment: "The error message captured from BGS if the end product update failed."
t.string :original_code, comment: "The original end product code before the update was submitted"
t.string :original_code, comment: "The original end product code before the update was submitted."
t.string :new_code, comment: "The new end product code the user wants to update to."
t.integer :active_request_issue_ids, null: false, array: true, default: [], comment: "A list of active request issue IDs when a user has finished editing a decision review. Used to keep track of which request issues may have been impacted by the update."
t.bigint :active_request_issue_ids, null: false, array: true, default: [], comment: "A list of active request issue IDs when a user has finished editing a decision review. Used to keep track of which request issues may have been impacted by the update."

t.timestamps null: false
t.index ["user_id"], name: "index_end_product_updates_on_user_id"
t.index ["end_product_establishment_id"], name: "index_end_product_updates_on_end_product_establishment_id"
t.references :user, null: false, foreign_key: true, comment: "The ID of the user who makes an end product update."
t.references :end_product_establishment, null: false, foreign_key: true, comment: "The end product establishment id used to track the end product being updated."
t.references :original_decision_review, null: true, polymorphic: true, index: false, comment: "The original decision review that this end product update belongs to; has a non-nil value only if a new decision_review was created."
end

add_index :end_product_updates, [:original_decision_review_type, :original_decision_review_id], algorithm: :concurrently, name: "index_epupdates_on_decision_review_type_and_decision_review_id"

change_column_comment :end_product_updates, :original_decision_review_type, "The original decision review type that this end product update belongs to"
end
end
17 changes: 9 additions & 8 deletions db/schema.rb
Expand Up @@ -584,18 +584,19 @@
end

create_table "end_product_updates", comment: "Updates the claim label for end products established from Caseflow", force: :cascade do |t|
t.integer "active_request_issue_ids", default: [], null: false, comment: "A list of active request issue IDs when a user has finished editing a decision review. Used to keep track of which request issues may have been impacted by the update.", array: true
t.bigint "active_request_issue_ids", default: [], null: false, comment: "A list of active request issue IDs when a user has finished editing a decision review. Used to keep track of which request issues may have been impacted by the update.", array: true
t.datetime "created_at", null: false
t.bigint "end_product_establishment_id", null: false, comment: "The end product establishment id used to track the end product being updated"
t.bigint "end_product_establishment_id", null: false, comment: "The end product establishment id used to track the end product being updated."
t.string "error", null: false, comment: "The error message captured from BGS if the end product update failed."
t.string "new_code", comment: "The new end product code the user wants to update to."
t.string "original_code", comment: "The original end product code before the update was submitted"
t.bigint "original_decision_review_id", null: false, comment: "The original ID of the decision review that this end product update belongs to; has a non-nil value only if a new decision_review was created."
t.string "original_decision_review_type", null: false, comment: "The original decision review type that this end product update belongs to"
t.string "original_code", comment: "The original end product code before the update was submitted."
t.bigint "original_decision_review_id", comment: "The original decision review that this end product update belongs to; has a non-nil value only if a new decision_review was created."
t.string "original_decision_review_type", comment: "The original decision review type that this end product update belongs to"
t.string "status", null: false, comment: "Status after an attempt to update the end product; expected values: 'success', 'error', ..."
t.datetime "updated_at", null: false
t.integer "user_id", comment: "The ID of the user who makes an end product update."
t.bigint "user_id", null: false, comment: "The ID of the user who makes an end product update."
t.index ["end_product_establishment_id"], name: "index_end_product_updates_on_end_product_establishment_id"
t.index ["original_decision_review_type", "original_decision_review_id"], name: "index_epupdates_on_decision_review_type_and_decision_review_id"
t.index ["user_id"], name: "index_end_product_updates_on_user_id"
end

Expand Down Expand Up @@ -1568,6 +1569,8 @@
add_foreign_key "docket_changes", "tasks"
add_foreign_key "document_views", "users"
add_foreign_key "end_product_establishments", "users"
add_foreign_key "end_product_updates", "end_product_establishments"
add_foreign_key "end_product_updates", "users"
add_foreign_key "hearing_days", "users", column: "created_by_id"
add_foreign_key "hearing_days", "users", column: "updated_by_id"
add_foreign_key "hearing_views", "users"
Expand All @@ -1589,6 +1592,4 @@
add_foreign_key "schedule_periods", "users"
add_foreign_key "user_quotas", "users"
add_foreign_key "virtual_hearings", "users", column: "updated_by_id"
add_foreign_key "end_product_updates", "users", column: "user_id"
add_foreign_key "end_product_updates", "end_product_establishments", column: "end_product_establishment_id"
end