-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add admin_update event to AuthorizationRequestEvent
Because of the change of diff management (on v1 it was on each update, v2 is on submit), changes from admin (without submit) is no longer displayed nor imported. We have to introduce a new event to store these diffs within changelog model.
- Loading branch information
Showing
7 changed files
with
81 additions
and
4 deletions.
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
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
48 changes: 48 additions & 0 deletions
48
db/migrate/20240514094958_more_and_more_constraints_to_authorization_request_events.rb
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,48 @@ | ||
class MoreAndMoreConstraintsToAuthorizationRequestEvents < ActiveRecord::Migration[7.1] | ||
def up | ||
execute <<-SQL | ||
ALTER TABLE authorization_request_events | ||
DROP CONSTRAINT entity_type_validation | ||
SQL | ||
|
||
execute <<-SQL | ||
ALTER TABLE authorization_request_events | ||
ADD CONSTRAINT entity_type_validation | ||
CHECK ( | ||
(name = 'refuse' AND entity_type = 'DenialOfAuthorization') OR | ||
(name = 'request_changes' AND entity_type = 'InstructorModificationRequest') OR | ||
(name = 'approve' AND entity_type = 'Authorization') OR | ||
(name = 'reopen' AND entity_type = 'Authorization') OR | ||
(name = 'submit' AND entity_type = 'AuthorizationRequestChangelog') OR | ||
(name = 'admin_update' AND entity_type = 'AuthorizationRequestChangelog') OR | ||
(name = 'applicant_message' AND entity_type = 'Message') OR | ||
(name = 'instructor_message' AND entity_type = 'Message') OR | ||
(name = 'revoke' AND entity_type = 'RevocationOfAuthorization') OR | ||
(entity_type = 'AuthorizationRequest') | ||
) | ||
SQL | ||
end | ||
|
||
def down | ||
execute <<-SQL | ||
ALTER TABLE authorization_request_events | ||
DROP CONSTRAINT entity_type_validation | ||
SQL | ||
|
||
execute <<-SQL | ||
ALTER TABLE authorization_request_events | ||
ADD CONSTRAINT entity_type_validation | ||
CHECK ( | ||
(name = 'refuse' AND entity_type = 'DenialOfAuthorization') OR | ||
(name = 'request_changes' AND entity_type = 'InstructorModificationRequest') OR | ||
(name = 'approve' AND entity_type = 'Authorization') OR | ||
(name = 'reopen' AND entity_type = 'Authorization') OR | ||
(name = 'submit' AND entity_type = 'AuthorizationRequestChangelog') OR | ||
(name = 'applicant_message' AND entity_type = 'Message') OR | ||
(name = 'instructor_message' AND entity_type = 'Message') OR | ||
(name = 'revoke' AND entity_type = 'RevocationOfAuthorization') OR | ||
(entity_type = 'AuthorizationRequest') | ||
) | ||
SQL | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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