Created
May 6, 2020 00:47
-
-
Save nmay231/af28b35d412a365c1d86fb6c7e33c60f to your computer and use it in GitHub Desktop.
Revisions
-
nmay231 created this gist
May 6, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ CREATE TABLE Test ( id integer primary key autoincrement, data text not null, _last_updated datetime default current_timestamp ); CREATE TRIGGER update_test_timestamp AFTER UPDATE ON Test BEGIN UPDATE Test SET _last_updated = datetime("now") WHERE id = new.id; END; INSERT INTO Test(data) VALUES("blah blah blah"); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ const connect = require('better-sqlite3') const db = connect('test.db', { fileMustExist: true }) db.prepare('UPDATE Test SET data=? WHERE id=?').run('blah blah 3.0', 1) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ { "name": "sqlite-bug", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "dependencies": { "better-sqlite3": "^7.0.1" } }