Skip to content

Commit 053843a

Browse files
committed
use table name in hash calculation for SQlite too
This changes the values of all hashes and tokens.
1 parent d5bf2c2 commit 053843a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

sqlab/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.5.2"
1+
__version__ = "0.5.3"

sqlab/dbms/sqlite/triggers.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ AFTER INSERT ON {table}
44
FOR EACH ROW
55
BEGIN
66
UPDATE {table}
7-
SET hash = string_hash(json_array({new_columns}))
7+
SET hash = string_hash(json_array('{table}', {new_columns}))
88
WHERE rowid = NEW.rowid; -- [...]
99
END;
1010

1111
DROP TRIGGER IF EXISTS after_update_{table};
1212
CREATE TRIGGER after_update_{table}
1313
AFTER UPDATE OF {columns} ON {table}
1414
FOR EACH ROW
15-
WHEN (OLD.hash <> string_hash(json_array({new_columns})))
15+
WHEN (OLD.hash <> string_hash(json_array('{table}', {new_columns})))
1616
BEGIN
1717
UPDATE {table}
1818
SET hash = string_hash(json_array({new_columns}))
19-
WHERE rowid = NEW.rowid AND (OLD.hash <> string_hash(json_array({new_columns}))); -- [...]
19+
WHERE rowid = NEW.rowid AND (OLD.hash <> string_hash(json_array('{table}', {new_columns}))); -- [...]
2020
END;

0 commit comments

Comments
 (0)