-
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.
job-mapping rename job_versions_io_mapping to job_io_mapping
Signed-off-by: Pawel Leszczynski <[email protected]>
- Loading branch information
1 parent
78325b6
commit d7166cc
Showing
13 changed files
with
636 additions
and
90 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
64 changes: 64 additions & 0 deletions
64
api/src/main/java/marquez/db/migrations/V67_2_JobVersionsIOMappingBackfillJob.java
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,64 @@ | ||
/* | ||
* Copyright 2018-2023 contributors to the Marquez project | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package marquez.db.migrations; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.flywaydb.core.api.MigrationVersion; | ||
import org.flywaydb.core.api.migration.Context; | ||
import org.flywaydb.core.api.migration.JavaMigration; | ||
import org.jdbi.v3.core.Jdbi; | ||
|
||
@Slf4j | ||
public class V67_2_JobVersionsIOMappingBackfillJob implements JavaMigration { | ||
|
||
public static final String UPDATE_QUERY = | ||
""" | ||
UPDATE job_io_mapping | ||
SET | ||
job_uuid = j.uuid, | ||
symlink_target_job_uuid = j.symlink_target_uuid, | ||
is_job_version_current = (jv.uuid = j.current_version_uuid)::BOOLEAN | ||
FROM job_versions jv | ||
INNER JOIN jobs_view j ON j.uuid = jv.job_uuid | ||
WHERE jv.uuid = job_io_mapping.job_version_uuid | ||
"""; | ||
|
||
@Override | ||
public MigrationVersion getVersion() { | ||
return MigrationVersion.fromVersion("67.2"); | ||
} | ||
|
||
@Override | ||
public void migrate(Context context) throws Exception { | ||
Jdbi jdbi = Jdbi.create(context.getConnection()); | ||
jdbi.withHandle(h -> h.createUpdate(UPDATE_QUERY).execute()); | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Back fill job_uuid and is_job_version_current in job_io_mapping table"; | ||
} | ||
|
||
@Override | ||
public Integer getChecksum() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean isUndo() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean canExecuteInTransaction() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isBaselineMigration() { | ||
return false; | ||
} | ||
} |
Oops, something went wrong.