aboutsummaryrefslogtreecommitdiff
path: root/migrations/auth/20240819_01_p2vXR-create-forgot-password-tokens-table.py
blob: 44318bd9713723ea583123d5116712c118968e66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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")
]