From 2324e4615a686d5d4eeeb5ac86e3f4db11ce941f Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Mon, 2 Jun 2025 18:28:28 +0200 Subject: [PATCH] insert value for position when creating new notebooks --- application/store.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/store.c b/application/store.c index d1a3706..6f2f231 100644 --- a/application/store.c +++ b/application/store.c @@ -98,8 +98,8 @@ "(?, ?, 1) returning resource_id;" #define SQL_NOTEBOOK_NEW \ - "insert into notebooks(resource_id) values " \ - "(?) returning notebook_id;" + "insert into notebooks(resource_id, position) " \ + "(?, (select coalesce(max(position), 0)+1 from notebooks)) returning notebook_id;" static DBUConnection *connection; -- 2.43.5