aboutsummaryrefslogtreecommitdiff
path: root/migrations
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-08-19 13:30:24 -0500
committerFrederick Muriuki Muriithi2024-08-19 13:30:24 -0500
commitbdcc9938343c838a8c0be98e6bf53d3bbc03d9df (patch)
tree65c9d8bf8153bdffa180149e1e17f3d931f39a05 /migrations
parent1b08f90fe0f87c5d39075a3ddd486da0682de52f (diff)
downloadgn-auth-bdcc9938343c838a8c0be98e6bf53d3bbc03d9df.tar.gz
Migrations: Add forgot_password_tokens table
Create the `forgot_password_tokens` table to be used to enable users change their passwords if they forget.
Diffstat (limited to 'migrations')
-rw-r--r--migrations/auth/20240819_01_p2vXR-create-forgot-password-tokens-table.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/migrations/auth/20240819_01_p2vXR-create-forgot-password-tokens-table.py b/migrations/auth/20240819_01_p2vXR-create-forgot-password-tokens-table.py
new file mode 100644
index 0000000..44318bd
--- /dev/null
+++ b/migrations/auth/20240819_01_p2vXR-create-forgot-password-tokens-table.py
@@ -0,0 +1,26 @@
+"""
+Create forgot_password_tokens table
+
+This will be used to enable users to validate/verify their password change
+requests.
+"""
+
+from yoyo import step
+
+__depends__ = {'20240606_03_BY7Us-drop-group-roles-table'}
+
+steps = [
+ step(
+ """
+ CREATE TABLE IF NOT EXISTS forgot_password_tokens(
+ user_id TEXT NOT NULL,
+ token TEXT NOT NULL,
+ generated INTEGER NOT NULL,
+ expires INTEGER NOT NULL,
+ PRIMARY KEY(user_id),
+ FOREIGN KEY(user_id) REFERENCES users(user_id)
+ ON UPDATE CASCADE ON DELETE CASCADE
+ ) WITHOUT ROWID
+ """,
+ "DROP TABLE IF EXISTS forgot_password_tokens")
+]