Fix: migrate forecast_points.wind_dir_deg on existing deployments
CREATE TABLE IF NOT EXISTS is a no-op against a table that already exists — it doesn't add columns introduced after the first deploy. The live LXC's forecast_points was created before wind_dir_deg existed, so every insert in lib/weather-fetch.js has been failing with 'column wind_dir_deg of relation forecast_points does not exist' since that feature landed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
435b59b3fe
commit
e4f4f031ef
1 changed files with 7 additions and 0 deletions
|
|
@ -60,6 +60,13 @@ export async function initDb() {
|
||||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||||
);
|
);
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
// wind_dir_deg was added to forecast_points after the first deploy already ran —
|
||||||
|
// CREATE TABLE IF NOT EXISTS above is a no-op against an existing table, it does
|
||||||
|
// NOT retroactively add new columns, so this needs its own explicit migration.
|
||||||
|
// forecast_astro/config didn't need this since they're whole new tables, which
|
||||||
|
// CREATE TABLE IF NOT EXISTS does handle correctly on an existing database.
|
||||||
|
await pool.query(`ALTER TABLE forecast_points ADD COLUMN IF NOT EXISTS wind_dir_deg NUMERIC`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getStatus() {
|
export async function getStatus() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue