-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from UW-Macrostrat/migrations-rework
Fix paleogeography subsystem; small improvements to migrations management
- Loading branch information
Showing
18 changed files
with
429 additions
and
209 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
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
22 changes: 22 additions & 0 deletions
22
cli/macrostrat/cli/database/migrations/maps_scale_custom_type/__init__.py
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,22 @@ | ||
from macrostrat.database import Database | ||
|
||
from ..base import Migration, custom_type_exists | ||
|
||
|
||
class MapsScaleCustomTypeMigration(Migration): | ||
name = "maps-scale-type" | ||
subsystem = "maps" | ||
description = """ | ||
Relocate custom type that drives the maps schema | ||
""" | ||
|
||
depends_on = ["baseline", "macrostrat-mariadb"] | ||
|
||
postconditions = [custom_type_exists("maps", "map_scale")] | ||
|
||
preconditions = [] | ||
|
||
def apply(self, db: Database): | ||
# Handle edge case where the MariaDB migration has already been applied | ||
db.run_sql("ALTER TYPE macrostrat_backup.map_scale SET SCHEMA macrostrat") | ||
db.run_sql("ALTER TYPE macrostrat.map_scale SET SCHEMA maps") |
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,8 @@ | ||
# Ad-hoc SQL scripts | ||
|
||
This directory contains ad-hoc SQL scripts that can be run on demand. | ||
These scripts aren't yet structured well enough to be included in the | ||
main codebase, but they are useful for one-off tasks. | ||
|
||
Ideally, these should eventually be integrated into data maintenance scripts | ||
or migrations. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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
Oops, something went wrong.