From f4d5577de16d895afbc54abbffb574fedd09a195 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Wed, 11 Feb 2026 10:10:54 +1100 Subject: [PATCH] add postgres migration --- ...60211090000_add_lowercase_compat_views.sql | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 db/migrations_postgres/20260211090000_add_lowercase_compat_views.sql diff --git a/db/migrations_postgres/20260211090000_add_lowercase_compat_views.sql b/db/migrations_postgres/20260211090000_add_lowercase_compat_views.sql new file mode 100644 index 0000000..d122604 --- /dev/null +++ b/db/migrations_postgres/20260211090000_add_lowercase_compat_views.sql @@ -0,0 +1,24 @@ +-- +goose Up +-- +goose StatementBegin +-- sqlc queries target lowercase table names. Postgres migrations historically +-- created quoted CamelCase tables, so expose lowercase compatibility views. +CREATE OR REPLACE VIEW inventory AS +SELECT * FROM "Inventory"; + +CREATE OR REPLACE VIEW updates AS +SELECT * FROM "Updates"; + +CREATE OR REPLACE VIEW events AS +SELECT * FROM "Events"; + +CREATE OR REPLACE VIEW inventory_history AS +SELECT * FROM "InventoryHistory"; +-- +goose StatementEnd + +-- +goose Down +-- +goose StatementBegin +DROP VIEW IF EXISTS inventory_history; +DROP VIEW IF EXISTS events; +DROP VIEW IF EXISTS updates; +DROP VIEW IF EXISTS inventory; +-- +goose StatementEnd