Skip to content

Commit

Permalink
add mysql column for touching
Browse files Browse the repository at this point in the history
  • Loading branch information
jessepeterson committed Jun 28, 2023
1 parent 2263546 commit 0f808d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions storage/mysql/schema.00001.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE declarations ADD COLUMN touched_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL;
ALTER TABLE declarations MODIFY COLUMN server_token CHAR(40) AS (SHA1(CONCAT(identifier, type, payload, created_at, touched_at))) STORED NOT NULL;
3 changes: 2 additions & 1 deletion storage/mysql/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ CREATE TABLE declarations (

created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL,
touched_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,

server_token VARCHAR(40) AS (SHA1(CONCAT(identifier, type, payload, created_at))) STORED NOT NULL,
server_token CHAR(40) AS (SHA1(CONCAT(identifier, type, payload, created_at, touched_at))) STORED NOT NULL,

PRIMARY KEY (identifier),

Expand Down

0 comments on commit 0f808d0

Please sign in to comment.