mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-21 01:23:40 +00:00
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.
This commit is contained in:
1 parent
24d85fd2e6
commit
d57e5c29c4
6 files changed
+181
-29
No files matched your search
@@ -0,0 +1,5 @@
|
||||
-- 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);
|
||||
Reference in new issue
Block a user