diff --git a/alembic/versions/0a8f99c161e2_index_ssh_search_key.py b/alembic/versions/0a8f99c161e2_index_ssh_search_key.py index 948d677..b6baf7f 100644 --- a/alembic/versions/0a8f99c161e2_index_ssh_search_key.py +++ b/alembic/versions/0a8f99c161e2_index_ssh_search_key.py @@ -7,8 +7,8 @@ Create Date: 2018-10-04 10:49:44.739141 """ # revision identifiers, used by Alembic. -revision = '0a8f99c161e2' -down_revision = 'ba538b2648b7' +revision = "0a8f99c161e2" +down_revision = "ba538b2648b7" from alembic import op import sqlalchemy as sa @@ -17,6 +17,12 @@ import sqlalchemy as sa def upgrade(): """ Creates an index on ssh_search_key in the deploykeys table. """ + op.alter_column( + "deploykeys", + "ssh_search_key", + nullable=False, + type_=sa.String(length=60), + ) op.create_index( op.f("ix_deploykeys_deploykeys_ssh_search_key"), "deploykeys", @@ -30,5 +36,8 @@ def downgrade(): """ op.drop_index( op.f("ix_deploykeys_deploykeys_ssh_search_key"), - table_name="deploykeys" + table_name="deploykeys", + ) + op.alter_column( + "deploykeys", "ssh_search_key", nullable=False, type_=sa.Text ) diff --git a/pagure/lib/model.py b/pagure/lib/model.py index cecd3c0..02da8b4 100644 --- a/pagure/lib/model.py +++ b/pagure/lib/model.py @@ -1142,7 +1142,7 @@ class SSHKey(BASE): public_ssh_key = sa.Column(sa.Text, nullable=False) ssh_short_key = sa.Column(sa.Text, nullable=False) ssh_search_key = sa.Column( - sa.Text, nullable=False, index=True, unique=True + sa.String(length=60), nullable=False, index=True, unique=True ) creator_user_id = sa.Column( sa.Integer,