11 lines
487 B
SQL
11 lines
487 B
SQL
-- Migration: addresses.bound_id — the bound a saved address belongs to.
|
|
--
|
|
-- Every address is assigned to a bound; new addresses get the user's active
|
|
-- bound. Existing rows are backfilled to bound 1.
|
|
--
|
|
-- NOTE: SQLite has no ADD COLUMN IF NOT EXISTS; rely on the migration journal to
|
|
-- run this once.
|
|
|
|
ALTER TABLE `addresses` ADD COLUMN `bound_id` integer REFERENCES `region_bounds`(`id`);
|
|
--> statement-breakpoint
|
|
UPDATE `addresses` SET `bound_id` = 1 WHERE `bound_id` IS NULL;
|