Files
WebHooker/migrations/0012_route_position.sql
T
翅膀 d57e5c29c4 feat(storage): persist the per-group route order
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.
2026-10-16 23:24:09 +08:00

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);