-
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.
save a lot of load time using s3 and materialized view based caching …
…for geojson, env based s3 files to come
- Loading branch information
1 parent
8306286
commit 249d3bd
Showing
3 changed files
with
58 additions
and
34 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
24 changes: 24 additions & 0 deletions
24
database/src/migrations/0072_materialize_current_and_negative_views.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,24 @@ | ||
import { Knex } from 'knex'; | ||
|
||
export async function up(knex: Knex): Promise<void> { | ||
await knex.raw( | ||
` | ||
set search_path=invasivesbc,public; | ||
create materialized view if not exists invasivesbc.current_positive_observations_materialized as (select * from invasivesbc.current_positive_observations ); | ||
create materialized view if not exists invasivesbc.current_negative_observations_materialized as (select * from invasivesbc.current_negative_observations ); | ||
` | ||
); | ||
} | ||
|
||
export async function down(knex: Knex): Promise<void> { | ||
await knex.raw(` | ||
drop materialized view invasivesbc.current_positive_observations_materialized; | ||
drop materialized view invasivesbc.current_negative_observations_materialized; | ||
`); | ||
} |