Skip to content

Commit

Permalink
fix jurisdiction layer geogs
Browse files Browse the repository at this point in the history
  • Loading branch information
brennanwebster authored and micheal-w-wells committed Sep 28, 2023
1 parent df249c0 commit ab2a720
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions database/src/migrations/0066_fix_jurisdiction_layer_geogs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Knex } from 'knex';

export async function up(knex: Knex): Promise<void> {
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<void> {
await knex.raw(`
set search_path='invasivesbc';
`);
}

0 comments on commit ab2a720

Please sign in to comment.