diff options
author | Anthony Wang | 2024-07-22 11:17:30 -0500 |
---|---|---|
committer | Anthony Wang | 2024-07-22 11:17:30 -0500 |
commit | 85dc148d6cea1fbd1c1444bec0fd2851a5ddf826 (patch) | |
tree | 3ea905a58fd6cefc94aee362e1d6aebfed0adc5c /sd-add.fish | |
parent | db359b424a85604ebefce2baacc1891103bc858d (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.fish | 3 |
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 |