mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-20 17:13:49 +00:00
Routes used to load in id order, so the order saved from the console was lost on the next read. Migration 0012 adds `d1_routes.position`: saving writes each route's index within its own group (saving one group never shifts another), and routes load by `group_id, position, id`. A database without the column keeps working: only a "no such column" / "has no column named" error falls back to the legacy statements, and nothing is cached, so a later migration is picked up on the next call.
6 lines
401 B
SQL
6 lines
401 B
SQL
-- Persist the user-defined route order inside each group. Routes load ordered by
|
|
-- (group_id, position, id); rows written before this migration keep position 0
|
|
-- and therefore stay in id order until their group's routes are saved again.
|
|
ALTER TABLE d1_routes ADD COLUMN position INTEGER NOT NULL DEFAULT 0;
|
|
CREATE INDEX IF NOT EXISTS idx_d1_routes_group_position ON d1_routes (group_id, position);
|