refactor(dates): condense the two date-contract migrations into one

Neither migration had shipped, so the #115 snapshot columns join the
#114 new-contract columns in 2026-09-24-000000_add_true_utc_dates.
Pure ADD COLUMN either way — population is runtime (drains), so nothing
needs re-migrating. Column order is unchanged, so schema.rs stands.
This commit is contained in:
Cameron Cordes committed 2026-09-25 15:39:23 -04:00
1 parent d2263be6ac
commit 7d7d7c713c
4 files changed
+19 -19

No files matched your search

@@ -1,4 +1,7 @@
ALTER TABLE user_ai_prefs DROP COLUMN display_tz; ALTER TABLE user_ai_prefs DROP COLUMN display_tz;
ALTER TABLE image_exif DROP COLUMN original_date_taken_tz_source;
ALTER TABLE image_exif DROP COLUMN original_camera_offset_minutes;
ALTER TABLE image_exif DROP COLUMN original_date_utc;
ALTER TABLE image_exif DROP COLUMN date_taken_tz_source; ALTER TABLE image_exif DROP COLUMN date_taken_tz_source;
ALTER TABLE image_exif DROP COLUMN camera_offset_minutes; ALTER TABLE image_exif DROP COLUMN camera_offset_minutes;
ALTER TABLE image_exif DROP COLUMN date_utc; ALTER TABLE image_exif DROP COLUMN date_utc;
@@ -1,4 +1,4 @@
-- True-instant date contract (ADR-0001 / spec #113, ticket #114). -- True-instant date contract (ADR-0001 / spec #113, tickets #114 + #115).
-- --
-- image_exif gains the new-contract columns alongside the untouched legacy -- image_exif gains the new-contract columns alongside the untouched legacy
-- `date_taken`: -- `date_taken`:
@@ -10,10 +10,23 @@
-- date_taken_tz_source — why the offset is what it is: -- date_taken_tz_source — why the offset is what it is:
-- offset_tag | gps | assumed_server | utc_direct -- offset_tag | gps | assumed_server | utc_direct
-- | manual. -- | manual.
-- user_ai_prefs gains the DST-proof display zone (IANA name); the legacy --
-- tz_offset_minutes column stays frozen for rollback. -- Manual date edits (ticket #115) write the new-contract triple alongside
-- the legacy pair and must be revertible, so image_exif also snapshots the
-- pre-override new-contract columns next to the existing legacy snapshot
-- pair (original_date_taken / original_date_taken_source):
-- original_date_utc / original_camera_offset_minutes /
-- original_date_taken_tz_source.
--
-- All columns are additive and nullable; population happens at runtime
-- (ingest + the per-tick backfill drains), so no backfill SQL is needed
-- here. user_ai_prefs gains the DST-proof display zone (IANA name); the
-- legacy tz_offset_minutes column stays frozen for rollback.
ALTER TABLE image_exif ADD COLUMN date_utc BIGINT; ALTER TABLE image_exif ADD COLUMN date_utc BIGINT;
ALTER TABLE image_exif ADD COLUMN camera_offset_minutes INTEGER; ALTER TABLE image_exif ADD COLUMN camera_offset_minutes INTEGER;
ALTER TABLE image_exif ADD COLUMN date_taken_tz_source TEXT; ALTER TABLE image_exif ADD COLUMN date_taken_tz_source TEXT;
ALTER TABLE image_exif ADD COLUMN original_date_utc BIGINT;
ALTER TABLE image_exif ADD COLUMN original_camera_offset_minutes INTEGER;
ALTER TABLE image_exif ADD COLUMN original_date_taken_tz_source TEXT;
ALTER TABLE user_ai_prefs ADD COLUMN display_tz TEXT; ALTER TABLE user_ai_prefs ADD COLUMN display_tz TEXT;
@@ -1,3 +0,0 @@
ALTER TABLE image_exif DROP COLUMN original_date_utc;
ALTER TABLE image_exif DROP COLUMN original_camera_offset_minutes;
ALTER TABLE image_exif DROP COLUMN original_date_taken_tz_source;
@@ -1,13 +0,0 @@
-- Manual date-edit rework (ticket #115).
--
-- POST /image/exif/date now writes the new-contract triple
-- (date_utc, camera_offset_minutes, date_taken_tz_source = 'manual')
-- alongside the legacy (date_taken, date_taken_source) pair. Reverting an
-- override must restore the resolver's new-contract triple as well as the
-- legacy pair, so image_exif snapshots the pre-override new-contract
-- columns next to the existing legacy snapshot pair
-- (original_date_taken / original_date_taken_source).
ALTER TABLE image_exif ADD COLUMN original_date_utc BIGINT;
ALTER TABLE image_exif ADD COLUMN original_camera_offset_minutes INTEGER;
ALTER TABLE image_exif ADD COLUMN original_date_taken_tz_source TEXT;