aboutsummaryrefslogtreecommitdiff
path: root/sd-add.fish
diff options
context:
space:
mode:
authorAnthony Wang2024-07-22 11:17:30 -0500
committerAnthony Wang2024-07-22 11:17:30 -0500
commit85dc148d6cea1fbd1c1444bec0fd2851a5ddf826 (patch)
tree3ea905a58fd6cefc94aee362e1d6aebfed0adc5c /sd-add.fish
parentdb359b424a85604ebefce2baacc1891103bc858d (diff)
Don't need to.manually set idx since INTEGER PRIMARY KEY basically does autoincrement
https://www.sqlite.org/faq.html#q1
Diffstat (limited to 'sd-add.fish')
-rw-r--r--sd-add.fish3
1 files changed, 1 insertions, 2 deletions
diff --git a/sd-add.fish b/sd-add.fish
index dd4eb62..9e0e0ba 100644
--- a/sd-add.fish
+++ b/sd-add.fish
@@ -1,4 +1,3 @@
function sd-add
- set idx (math 1+(sqlite3 "$argv[1]" "SELECT MAX(idx) FROM cards"))
- sqlite3 "$argv[1]" "INSERT INTO cards VALUES ($idx, 256, '$argv[2]', '$argv[3]')"
+ sqlite3 "$argv[1]" "INSERT INTO cards VALUES (NULL, 256, '$argv[2]', '$argv[3]')"
end