aboutsummaryrefslogtreecommitdiff
path: root/migrations/versions/be6e229d6a3d_do_not_limit_username_and_password_hash_.py
blob: 4bb7a7c8a53000eeb6a12eeebb333097525b7aa9 (plain) (blame)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# SPDX-FileCopyrightText: 2026 Dennis Fink <me+coding@dennisfink.me>
#
# SPDX-License-Identifier: BSD-3-Clause

"""Do not limit username and password hash length

Revision ID: be6e229d6a3d
Revises: 681a2a9a1bc0
Create Date: 2026-08-16 20:38:27.992624

"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "be6e229d6a3d"
down_revision = "681a2a9a1bc0"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("users", schema=None) as batch_op:
        batch_op.alter_column(
            "username",
            existing_type=sa.VARCHAR(length=64),
            type_=sa.Text(),
            existing_nullable=False,
        )
        batch_op.alter_column(
            "password_hash",
            existing_type=sa.VARCHAR(length=256),
            type_=sa.Text(),
            nullable=False,
        )

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("users", schema=None) as batch_op:
        batch_op.alter_column(
            "password_hash",
            existing_type=sa.Text(),
            type_=sa.VARCHAR(length=256),
            nullable=True,
        )
        batch_op.alter_column(
            "username",
            existing_type=sa.Text(),
            type_=sa.VARCHAR(length=64),
            existing_nullable=False,
        )

    # ### end Alembic commands ###