diff --git a/alembic/versions/c34f4b09ef18_star_a_project.py b/alembic/versions/c34f4b09ef18_star_a_project.py index 4f70daf..d6c5272 100644 --- a/alembic/versions/c34f4b09ef18_star_a_project.py +++ b/alembic/versions/c34f4b09ef18_star_a_project.py @@ -37,7 +37,7 @@ def upgrade(): ) op.create_unique_constraint( - constraint_name='stargazers_project_id_user_id_key', + constraint_name='uq_stargazers_project_id_user_id_key', table_name='stargazers', columns=['project_id', 'user_id'] ) @@ -46,7 +46,7 @@ def upgrade(): def downgrade(): ''' Remove the stargazers table from the database ''' op.drop_constraint( - constraint_name='stargazers_project_id_user_id_key', + constraint_name='uq_stargazers_project_id_user_id_key', table_name='stargazers' ) op.drop_table('stargazers') diff --git a/pagure/lib/model.py b/pagure/lib/model.py index 71232f0..fd4b130 100644 --- a/pagure/lib/model.py +++ b/pagure/lib/model.py @@ -2106,7 +2106,10 @@ class Star(BASE): __tablename__ = 'stargazers' __table_args__ = ( - sa.UniqueConstraint('project_id', 'user_id'), + sa.UniqueConstraint( + 'project_id', + 'user_id', + name='uq_stargazers_project_id_user_id_key'), ) id = sa.Column(sa.Integer, primary_key=True)