-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Edit EP Claim Labels | Add End Product Update model (#15383)
Connects #15330 ### Description This pr adds a new End Product Update table and model ### Acceptance Criteria - [ ] DB migration to add EndProductUpdate - [ ] Timestamps - [ ] User ID - [ ] EndProductEstablishment ID - [ ] Original code - [ ] New code - [ ] Original decision review ID - [ ] Status (success/error) - [ ] Error - [ ] IDs of active request issues on the end product establishment ### Database Changes *Only for Schema Changes* * [x] Timestamps (created_at, updated_at) for new tables * [x] Column comments updated * [x] Have your migration classes inherit from `Caseflow::Migration`, especially when adding indexes (use `add_safe_index`) * [x] Verify that `migrate:rollback` works as desired ([`change` supported functions](https://edgeguides.rubyonrails.org/active_record_migrations.html#using-the-change-method)) * [ ] Query profiling performed (eyeball Rails log, check bullet and fasterer output) * [x] Appropriate indexes added (especially for foreign keys, polymorphic columns, unique constraints, and Rails scopes) * [x] DB schema docs updated with `make docs` (after running `make migrate`) * [x] #appeals-schema notified with summary and link to this PR
- Loading branch information
Showing
5 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
# This is for updating the claim label for end products established from Caseflow | ||
|
||
class EndProductUpdate < CaseflowRecord | ||
belongs_to :end_product_establishment | ||
belongs_to :original_decision_review, polymorphic: true | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class CreateEndProductUpdate < Caseflow::Migration | ||
disable_ddl_transaction! | ||
|
||
def change | ||
create_table :end_product_updates, comment: "Updates the claim label for end products established from Caseflow" do |t| | ||
t.string :status, comment: "Status after an attempt to update the end product; expected values: 'success', 'error', ..." | ||
t.string :error, 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 :new_code, comment: "The new end product code the user wants to update to." | ||
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.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 |
This file contains 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
This file contains 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