-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MDS-6120] Add permit conditions version history (#3228)
* Add permit conditions version history migration Add mounts for migrations to docker-compose files, create history and backfill SQL migration scripts for permit conditions, update version table generation logic, and fix documentation typo. * updated permit condition put test to also test versioning
- Loading branch information
1 parent
be1d7c0
commit 8d333de
Showing
8 changed files
with
85 additions
and
5 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
24 changes: 24 additions & 0 deletions
24
migrations/sql/V2024.08.26.19.42__add_permit_conditions_version_history_table.sql
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,24 @@ | ||
-- This file was generated by the generate_history_table_ddl command | ||
-- The file contains the corresponding history table definition for the {table} table | ||
CREATE TABLE permit_conditions_version ( | ||
create_user VARCHAR(60), | ||
create_timestamp TIMESTAMP WITHOUT TIME ZONE, | ||
update_user VARCHAR(60), | ||
update_timestamp TIMESTAMP WITHOUT TIME ZONE, | ||
deleted_ind BOOLEAN, | ||
permit_condition_id INTEGER NOT NULL, | ||
permit_amendment_id INTEGER, | ||
permit_condition_guid UUID, | ||
condition VARCHAR, | ||
condition_category_code VARCHAR, | ||
condition_type_code VARCHAR, | ||
parent_permit_condition_id INTEGER, | ||
display_order INTEGER, | ||
transaction_id BIGINT NOT NULL, | ||
end_transaction_id BIGINT, | ||
operation_type SMALLINT NOT NULL, | ||
PRIMARY KEY (permit_condition_id, transaction_id) | ||
); | ||
CREATE INDEX ix_permit_conditions_version_end_transaction_id ON permit_conditions_version (end_transaction_id); | ||
CREATE INDEX ix_permit_conditions_version_operation_type ON permit_conditions_version (operation_type); | ||
CREATE INDEX ix_permit_conditions_version_transaction_id ON permit_conditions_version (transaction_id); |
6 changes: 6 additions & 0 deletions
6
migrations/sql/V2024.08.26.19.43__add_permit_conditions_version_history_table_backfill.sql
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,6 @@ | ||
-- This file was generated by the generate_history_table_ddl command | ||
-- The file contains the data migration to backfill history records for the {table} table | ||
with transaction AS (insert into transaction(id) values(DEFAULT) RETURNING id) | ||
insert into permit_conditions_version (transaction_id, operation_type, end_transaction_id, "create_user", "create_timestamp", "update_user", "update_timestamp", "deleted_ind", "permit_condition_id", "permit_amendment_id", "permit_condition_guid", "condition", "condition_category_code", "condition_type_code", "parent_permit_condition_id", "display_order") | ||
select t.id, '0', null, "create_user", "create_timestamp", "update_user", "update_timestamp", "deleted_ind", "permit_condition_id", "permit_amendment_id", "permit_condition_guid", "condition", "condition_category_code", "condition_type_code", "parent_permit_condition_id", "display_order" | ||
from permit_conditions,transaction t; |
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