]> uap-core.de Git - note.git/commitdiff
insert value for position when creating new notebooks
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Mon, 2 Jun 2025 16:28:28 +0000 (18:28 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Mon, 2 Jun 2025 16:28:28 +0000 (18:28 +0200)
application/store.c

index d1a37069262ddfa7b03726d7905fe260399cb3fa..6f2f231ee0fd4cfdfd0150d16668dcd95a76eb3c 100644 (file)
@@ -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;