-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Runless events - refactor job_versions_io_mapping
Signed-off-by: Pawel Leszczynski <[email protected]>
- Loading branch information
1 parent
2cb3e37
commit 9f1dedd
Showing
9 changed files
with
117 additions
and
48 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
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
15 changes: 15 additions & 0 deletions
15
...rc/main/resources/marquez/db/migration/V66__job_versions_io_mapping_add_job_reference.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,15 @@ | ||
ALTER TABLE job_versions_io_mapping ADD COLUMN job_uuid uuid REFERENCES jobs(uuid) ON DELETE CASCADE; | ||
ALTER TABLE job_versions_io_mapping ADD COLUMN symlink_target_job_uuid uuid REFERENCES jobs(uuid) ON DELETE CASCADE; | ||
ALTER TABLE job_versions_io_mapping ADD COLUMN is_job_version_current boolean DEFAULT FALSE; | ||
-- TODO: create index for lineage query and update | ||
|
||
CREATE INDEX job_versions_io_mapping_job_uuid ON job_versions_io_mapping (job_uuid); | ||
|
||
-- To add job_uuid to the unique constraint, we first drop the primary key, then recreate it; note given that job_version_uuid can be NULL, we need to check that job_version_uuid != NULL before inserting (duplicate columns otherwise) | ||
ALTER TABLE job_versions_io_mapping DROP CONSTRAINT job_versions_io_mapping_pkey; | ||
ALTER TABLE job_versions_io_mapping ADD CONSTRAINT job_versions_io_mapping_pkey UNIQUE (job_version_uuid,dataset_uuid,io_type,job_uuid); | ||
|
||
-- TODO: add a test which verifies correctness for UNIQUE <- adds multiple rows to job_versions_io_mapping | ||
|
||
-- TODO: take care of is_current | ||
-- TODO: take care of symlink_job_uuid |
6 changes: 6 additions & 0 deletions
6
...rc/main/resources/marquez/db/migration/V67__job_versions_io_mapping_add_job_reference.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 @@ | ||
UPDATE job_versions_io_mapping | ||
SET job_uuid = job_versions.job_uuid | ||
FROM job_versions | ||
WHERE job_versions_io_mapping.job_version_uuid = job_versions.uuid; | ||
|
||
-- TODO: include a test for that, can be a migration test |
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