poi-index: name pois PK explicitly (pois_pkey) for drift-free swap
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
96de8831cf
commit
b1aa687c51
2 changed files with 4 additions and 2 deletions
|
|
@ -52,7 +52,9 @@ export const pois = plannerSchema.table("pois", {
|
|||
tags: jsonb("tags").$type<Record<string, string>>().notNull(),
|
||||
importedAt: timestamp("imported_at", { withTimezone: true }).notNull().defaultNow(),
|
||||
}, (t) => ({
|
||||
pk: primaryKey({ columns: [t.osmType, t.osmId, t.category] }),
|
||||
// Named explicitly so the import job's atomic swap can rename the staging
|
||||
// table's PK to this exact name — keeping `db:push` drift-free post-swap.
|
||||
pk: primaryKey({ name: "pois_pkey", columns: [t.osmType, t.osmId, t.category] }),
|
||||
// GiST spatial index for the bbox intersection in the serving query.
|
||||
geomIdx: index("pois_geom_idx").using("gist", t.geom),
|
||||
// btree on category so `category = ANY($cats)` is index-driven.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue