diff --git a/database/src/migrations/0066_fix_jurisdiction_layer_geogs.ts b/database/src/migrations/0066_fix_jurisdiction_layer_geogs.ts new file mode 100644 index 000000000..83dc79178 --- /dev/null +++ b/database/src/migrations/0066_fix_jurisdiction_layer_geogs.ts @@ -0,0 +1,23 @@ +import { Knex } from 'knex'; + +export async function up(knex: Knex): Promise { + await knex.raw( + ` + set search_path=invasivesbc,public; + + update public.jurisdiction + set geog = ST_CollectionExtract(ST_MakeValid(geog::geometry),3)::geography + where not ST_IsValid(geog::geometry); +` + ); +} + +export async function down(knex: Knex): Promise { + await knex.raw(` + + set search_path='invasivesbc'; + + + + `); +}