-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bcb10cb
commit 0399d4a
Showing
5 changed files
with
425 additions
and
8 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## Drizzle | ||
|
||
### LibsqlError: SQL_NO_STATEMENT: SQL string does not contain any statemen | ||
|
||
- the last statement cannot be `--> statement-breakpoint` |
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
CREATE TABLE `activity`( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`action` text NOT NULL, | ||
`card_id` text NOT NULL, | ||
`user_id` text NOT NULL, | ||
`created_at` integer DEFAULT (unixepoch()) NOT NULL, | ||
FOREIGN KEY (`card_id`) REFERENCES `card`(`id`) ON UPDATE NO action ON DELETE NO action, | ||
FOREIGN KEY (`user_id`) REFERENCES `auth_user`(`id`) ON UPDATE NO action ON DELETE NO action | ||
); | ||
|
||
--> statement-breakpoint | ||
CREATE TRIGGER log_card_insert | ||
AFTER INSERT ON card | ||
BEGIN | ||
INSERT INTO activity(id, | ||
action, | ||
card_id, | ||
user_id, | ||
created_at) | ||
VALUES(lower(hex(randomblob(16))), | ||
'INSERT', | ||
NEW.id, | ||
NEW.user_id, | ||
strftime('%s', 'now')); | ||
|
||
END; | ||
|
||
--> statement-breakpoint | ||
CREATE TRIGGER log_card_update | ||
AFTER UPDATE ON card | ||
BEGIN | ||
INSERT INTO activity(id, | ||
action, | ||
card_id, | ||
user_id, | ||
created_at) | ||
VALUES(lower(hex(randomblob(16))), | ||
'UPDATE', | ||
NEW.id, | ||
NEW.user_id, | ||
strftime('%s', 'now')); | ||
|
||
END; | ||
|
||
--> statement-breakpoint | ||
CREATE TRIGGER log_card_delete | ||
AFTER DELETE ON card | ||
BEGIN | ||
INSERT INTO activity(id, | ||
action, | ||
card_id, | ||
user_id, | ||
created_at) | ||
VALUES(lower(hex(randomblob(16))), | ||
'DELETE', | ||
OLD.id, | ||
OLD.user_id, | ||
strftime('%s', 'now')); | ||
|
||
END; | ||
|
Oops, something went wrong.