revert: remove ADD COLUMN IF NOT EXISTS (not a SQLite feature)
SQLite does not support ADD COLUMN IF NOT EXISTS regardless of version. The idempotency fix lives in cf-core's migration runner instead.
This commit is contained in:
parent
59f728cba0
commit
45c758bb53
2 changed files with 5 additions and 7 deletions
|
|
@ -1,12 +1,10 @@
|
||||||
-- Staging DB: persistent listing tracking across searches.
|
-- Staging DB: persistent listing tracking across searches.
|
||||||
-- Adds temporal metadata to listings so we can detect stale/repriced/recurring items.
|
-- Adds temporal metadata to listings so we can detect stale/repriced/recurring items.
|
||||||
|
|
||||||
-- IF NOT EXISTS (SQLite 3.35+, Python 3.11 ships 3.39+) makes this safe to re-run
|
ALTER TABLE listings ADD COLUMN first_seen_at TEXT;
|
||||||
-- in any state: fresh install, partial-failure recovery, or already-applied.
|
ALTER TABLE listings ADD COLUMN last_seen_at TEXT;
|
||||||
ALTER TABLE listings ADD COLUMN IF NOT EXISTS first_seen_at TEXT;
|
ALTER TABLE listings ADD COLUMN times_seen INTEGER NOT NULL DEFAULT 1;
|
||||||
ALTER TABLE listings ADD COLUMN IF NOT EXISTS last_seen_at TEXT;
|
ALTER TABLE listings ADD COLUMN price_at_first_seen REAL;
|
||||||
ALTER TABLE listings ADD COLUMN IF NOT EXISTS times_seen INTEGER NOT NULL DEFAULT 1;
|
|
||||||
ALTER TABLE listings ADD COLUMN IF NOT EXISTS price_at_first_seen REAL;
|
|
||||||
|
|
||||||
-- Backfill existing rows so columns are non-null where we have data
|
-- Backfill existing rows so columns are non-null where we have data
|
||||||
UPDATE listings SET
|
UPDATE listings SET
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
-- Add per-listing category name, extracted from eBay API response.
|
-- Add per-listing category name, extracted from eBay API response.
|
||||||
-- Used to derive seller category_history_json without _ssn scraping.
|
-- Used to derive seller category_history_json without _ssn scraping.
|
||||||
ALTER TABLE listings ADD COLUMN IF NOT EXISTS category_name TEXT;
|
ALTER TABLE listings ADD COLUMN category_name TEXT;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue