-
Notifications
You must be signed in to change notification settings - Fork 9
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 #1492 from weather-gov/mgwalker/1490-spatial-table…
…-keys Update how spatial schemas are managed; update zone schema to add spatial index
- Loading branch information
Showing
9 changed files
with
260 additions
and
139 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = async ({ from, metadata: { table, schemas } }) => { | ||
const schemaVersions = Object.keys(schemas).filter( | ||
(version) => +version > from, | ||
); | ||
const upgrades = [...Array(schemaVersions.length)].map( | ||
// Plus one because our schema versions are 1-based, not 0-based. | ||
(_, i) => i + from + 1, | ||
); | ||
|
||
let needsDataUpdate = false; | ||
for await (const version of upgrades) { | ||
console.log(` upgrading ${table} schema to version ${version}`); | ||
const versionNeedsDataUpdate = await schemas[version](); | ||
|
||
needsDataUpdate = needsDataUpdate || versionNeedsDataUpdate; | ||
} | ||
|
||
return needsDataUpdate; | ||
}; |
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.