diff --git a/member_database/authentication/models.py b/member_database/authentication/models.py index 4351fbb..c235ceb 100644 --- a/member_database/authentication/models.py +++ b/member_database/authentication/models.py @@ -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) diff --git a/migrations/versions/742e6adb504c_increase_length_of_password_hash_field.py b/migrations/versions/742e6adb504c_increase_length_of_password_hash_field.py new file mode 100644 index 0000000..6370d48 --- /dev/null +++ b/migrations/versions/742e6adb504c_increase_length_of_password_hash_field.py @@ -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 ###