-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use `TIMESTAMPTZ` Signed-off-by: Willy Lulciuc <[email protected]> * Recreate `job` and `dataset` views Signed-off-by: Willy Lulciuc <[email protected]> * Only drop views and trigger Signed-off-by: Willy Lulciuc <[email protected]> * Fix migration for repeatable scripts Signed-off-by: Willy Lulciuc <[email protected]> * Use `CREATE VIEW OR REPLACE` on `datasets_view` Signed-off-by: Willy Lulciuc <[email protected]> * Fix repeatable view query syntax Signed-off-by: Willy Lulciuc <[email protected]> --------- Signed-off-by: Willy Lulciuc <[email protected]> Co-authored-by: Peter Hicks <[email protected]>
- Loading branch information
Showing
5 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
3 changes: 1 addition & 2 deletions
3
...rquez/db/migration/R__3_Datasets_view.sql → ...marquez/db/migration/R__Datasets_view.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
File renamed without changes.
File renamed without changes.
File renamed without changes.
53 changes: 53 additions & 0 deletions
53
api/src/main/resources/marquez/db/migration/V73__alter_all_timestamps_to_timestamptz.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,53 @@ | ||
ALTER TABLE namespaces ALTER COLUMN created_at TYPE TIMESTAMPTZ | ||
USING created_at AT TIME ZONE 'UTC'; | ||
ALTER TABLE namespaces ALTER COLUMN updated_at TYPE TIMESTAMPTZ | ||
USING updated_at AT TIME ZONE 'UTC'; | ||
|
||
ALTER TABLE sources ALTER COLUMN created_at TYPE TIMESTAMPTZ | ||
USING created_at AT TIME ZONE 'UTC'; | ||
ALTER TABLE sources ALTER COLUMN updated_at TYPE TIMESTAMPTZ | ||
USING updated_at AT TIME ZONE 'UTC'; | ||
|
||
-- Drop view 'datasets_view' before applying time zone to table 'datasets'. | ||
DROP VIEW IF EXISTS datasets_view CASCADE; | ||
|
||
ALTER TABLE datasets ALTER COLUMN created_at TYPE TIMESTAMPTZ | ||
USING created_at AT TIME ZONE 'UTC'; | ||
ALTER TABLE datasets ALTER COLUMN updated_at TYPE TIMESTAMPTZ | ||
USING updated_at AT TIME ZONE 'UTC'; | ||
|
||
ALTER TABLE dataset_fields ALTER COLUMN created_at TYPE TIMESTAMPTZ | ||
USING created_at AT TIME ZONE 'UTC'; | ||
ALTER TABLE dataset_fields ALTER COLUMN updated_at TYPE TIMESTAMPTZ | ||
USING updated_at AT TIME ZONE 'UTC'; | ||
|
||
ALTER TABLE dataset_versions ALTER COLUMN created_at TYPE TIMESTAMPTZ | ||
USING created_at AT TIME ZONE 'UTC'; | ||
|
||
-- Drop view 'jobs_view' (and trigger) before applying time zone to table 'jobs'. | ||
DROP TRIGGER IF EXISTS update_symlinks ON jobs_view; | ||
DROP VIEW IF EXISTS jobs_view CASCADE; | ||
|
||
ALTER TABLE jobs ALTER COLUMN created_at TYPE TIMESTAMPTZ | ||
USING created_at AT TIME ZONE 'UTC'; | ||
ALTER TABLE jobs ALTER COLUMN updated_at TYPE TIMESTAMPTZ | ||
USING updated_at AT TIME ZONE 'UTC'; | ||
|
||
ALTER TABLE job_versions ALTER COLUMN created_at TYPE TIMESTAMPTZ | ||
USING created_at AT TIME ZONE 'UTC'; | ||
ALTER TABLE job_versions ALTER COLUMN updated_at TYPE TIMESTAMPTZ | ||
USING updated_at AT TIME ZONE 'UTC'; | ||
|
||
ALTER TABLE runs ALTER COLUMN created_at TYPE TIMESTAMPTZ | ||
USING created_at AT TIME ZONE 'UTC'; | ||
ALTER TABLE runs ALTER COLUMN updated_at TYPE TIMESTAMPTZ | ||
USING updated_at AT TIME ZONE 'UTC'; | ||
|
||
ALTER TABLE run_states ALTER COLUMN transitioned_at TYPE TIMESTAMPTZ | ||
USING transitioned_at AT TIME ZONE 'UTC'; | ||
|
||
ALTER TABLE tags ALTER COLUMN created_at TYPE TIMESTAMPTZ | ||
USING created_at AT TIME ZONE 'UTC'; | ||
ALTER TABLE tags ALTER COLUMN updated_at TYPE TIMESTAMPTZ | ||
USING updated_at AT TIME ZONE 'UTC'; | ||
|