Skip to content

Commit

Permalink
Increase max-size of password hash field, fixes #221
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Jan 19, 2024
1 parent b73f3e8 commit e0a83af
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion member_database/authentication/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class User(UserMixin, db.Model):
id = db.Column(db.Integer, primary_key=True)

username = db.Column(db.String(64), index=True, unique=True)
password_hash = db.Column(db.String(128))
password_hash = db.Column(db.String(256))

person_id = db.Column(db.Integer, db.ForeignKey("person.id"), nullable=False)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""Increase length of password_hash field
Revision ID: 742e6adb504c
Revises: 0151da823114
Create Date: 2024-01-19 12:51:21.629225
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "742e6adb504c"
down_revision = "0151da823114"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("user", schema=None) as batch_op:
batch_op.alter_column(
"password_hash",
existing_type=sa.VARCHAR(length=128),
type_=sa.String(length=256),
existing_nullable=True,
)

# ### end Alembic commands ###


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

# ### end Alembic commands ###

0 comments on commit e0a83af

Please sign in to comment.