-
-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/read replica for geocoding #305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
| import { type Kysely, sql } from "kysely"; | ||
|
|
||
| export async function up(db: Kysely<any>): Promise<void> { | ||
| await sql`CREATE EXTENSION IF NOT EXISTS btree_gist`.execute(db); | ||
| await sql`CREATE INDEX area_area_set_id_geography_gist ON area USING GIST (area_set_id, geography)`.execute( | ||
| db, | ||
| ); | ||
| } | ||
|
|
||
| export async function down(db: Kysely<any>): Promise<void> { | ||
| await sql`DROP INDEX IF EXISTS area_area_set_id_geography_gist`.execute(db); | ||
| await sql`DROP EXTENSION IF EXISTS btree_gist`.execute(db); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,11 @@ import { | |
| } from "@/server/repositories/MapView"; | ||
| import { upsertOrganisation } from "@/server/repositories/Organisation"; | ||
| import { AreaSetCode, AreaSetGroupCode } from "../models/AreaSet"; | ||
| import { ColorScheme, MapStyleName } from "../models/MapView"; | ||
| import { | ||
| ColorScheme, | ||
| DEFAULT_CALCULATION_TYPE, | ||
| MapStyleName, | ||
| } from "../models/MapView"; | ||
| import { countDataRecordsForDataSource } from "../repositories/DataRecord"; | ||
| import type { MapView } from "../models/MapView"; | ||
| import type { DataSource } from "@/server/models/DataSource"; | ||
|
|
@@ -87,11 +91,12 @@ const ensureOrganisationMap = async (orgId: string): Promise<Map> => { | |
| areaDataColumn: "Lab", | ||
| areaDataSourceId: electionResultsDataSource.id, | ||
| areaSetGroupCode: AreaSetGroupCode.WMC24, | ||
| calculationType: null, | ||
| calculationType: DEFAULT_CALCULATION_TYPE, | ||
|
||
| colorScheme: ColorScheme.GreenYellowRed, | ||
| mapStyleName: MapStyleName.Light, | ||
| reverseColorScheme: false, | ||
| showBoundaryOutline: true, | ||
| showChoropleth: true, | ||
|
||
| showLabels: true, | ||
| showLocations: true, | ||
| showMembers: true, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropping the btree_gist extension in the down migration is potentially unsafe. If other GIST indexes or database objects depend on this extension, the DROP EXTENSION command will fail. PostgreSQL extensions are shared across the database, not tied to individual indexes. Consider removing this line from the down migration, as the extension may be needed by other parts of the database or future migrations. The index removal on line 12 is sufficient for the down migration.