-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into update_ministry_names
- Loading branch information
Showing
9 changed files
with
188 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
handle purging the offline storage on app version upgrade | ||
*/ | ||
export const CURRENT_MIGRATION_VERSION = 20241118; | ||
export const CURRENT_MIGRATION_VERSION = 20250113; | ||
export const MIGRATION_VERSION_KEY = '_persistedMigrationVersion'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Knex } from 'knex'; | ||
import axios from 'axios'; | ||
import { ungzip } from 'node-gzip'; | ||
|
||
export async function up(knex: Knex): Promise<void> { | ||
try { | ||
const url = 'https://nrs.objectstore.gov.bc.ca/seeds/CRD_IPMAS.sql.gz'; | ||
const { data } = await axios.get(url, { responseType: 'arraybuffer' }); | ||
const sql = await ungzip(data); | ||
|
||
await knex.raw(sql.toString()); | ||
} catch (e) { | ||
console.error('Failed to insert IPMAS data:', e); | ||
throw e; | ||
} | ||
} | ||
|
||
export async function down(knex: Knex): Promise<void> { | ||
try { | ||
await knex.raw(` | ||
DELETE FROM public.invasive_plant_management_areas | ||
WHERE agency_cd = 'CRD'; | ||
`); | ||
} catch (e) { | ||
console.error('Failed to rollback IPMAS data:', e); | ||
throw e; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
database/src/migrations/0031_add_nrrm_to_regional_districts.ts
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,28 @@ | ||
import { Knex } from 'knex'; | ||
import axios from 'axios'; | ||
import { ungzip } from 'node-gzip'; | ||
|
||
export async function up(knex: Knex): Promise<void> { | ||
try { | ||
const url = 'https://nrs.objectstore.gov.bc.ca/seeds/NRRM.sql.gz'; | ||
const { data } = await axios.get(url, { responseType: 'arraybuffer' }); | ||
const sql = await ungzip(data); | ||
|
||
await knex.raw(sql.toString()); | ||
} catch (e) { | ||
console.error('Failed to insert NRRM data:', e); | ||
throw e; | ||
} | ||
} | ||
|
||
export async function down(knex: Knex): Promise<void> { | ||
try { | ||
await knex.raw(` | ||
DELETE FROM public.regional_districts | ||
WHERE agency_cd = 'NRRM'; | ||
`); | ||
} catch (e) { | ||
console.error('Failed to rollback NRRM data:', e); | ||
throw e; | ||
} | ||
} |