-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added trigger and changed schema table
- Loading branch information
Showing
3 changed files
with
23 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
package sqlite | ||
|
||
const table string = ` | ||
CREATE TABLE IF NOT EXISTS command( | ||
id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
cmd TEXT NOT NULL UNIQUE, | ||
description TEXT NOT NULL | ||
); | ||
` | ||
CREATE VIRTUAL TABLE IF NOT EXISTS commands_fts USING fts5( | ||
id, | ||
cmd, | ||
desc, | ||
updated_at, | ||
created_at, | ||
deleted_at, | ||
content='commands', | ||
content_rowid='id' | ||
); | ||
CREATE TRIGGER IF NOT EXISTS commands_insert AFTER INSERT ON commands | ||
BEGIN | ||
INSERT INTO commands_fts (rowid, cmd, desc, updated_at, created_at, deleted_at) | ||
VALUES (new.id, new.cmd, new.desc, new.updated_at, new.created_at, new.deleted_at); | ||
END; | ||
` |
This file contains 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 characters
This file contains 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 characters