-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: separate view-tokens from push-tokens
- Loading branch information
Showing
9 changed files
with
227 additions
and
53 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
.sqlx/query-6b09783989b873e1fb176b3bf696fe54ad4b264aa4b7f1d0031720ebff9afed1.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
.sqlx/query-84c94a42edaf93c472b26026b5b317765b14203759d21b02637b125c7e31e255.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...fe01baa432c166829204c5c97ae74654e86e.json → ...d5604e30ad8414d0645ad667295822930064.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...aecc3343a4fafdbce1c6e39aa1cdc785990a.json → ...637eef75cbc4bab4dfc568379d6a38a081c6.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,4 @@ | ||
-- Add down migration script here | ||
|
||
DROP INDEX IF EXISTS idx_view_tokens_token; | ||
DROP TABLE view_tokens; |
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,19 @@ | ||
-- Add up migration script here | ||
|
||
CREATE TABLE view_tokens ( | ||
id SERIAL PRIMARY KEY, | ||
token TEXT NOT NULL, | ||
user_id INT NOT NULL, | ||
view_token_valid_until TIMESTAMP NULL, | ||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
last_accessed_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
||
FOREIGN KEY (user_id) REFERENCES users (id) | ||
); | ||
|
||
CREATE INDEX IF NOT EXISTS idx_view_tokens_token ON view_tokens (token); | ||
|
||
-- Insert all existing tokens also as view tokens | ||
INSERT INTO view_tokens (token, user_id, view_token_valid_until) | ||
SELECT token, user_id, datetime('now', '+60 years') as view_token_valid_until | ||
FROM tokens; |
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
Oops, something went wrong.