#32 [frontend] ensure mock triplets are unique
Merged 7 years ago by praiskup. Opened 7 years ago by praiskup.

@@ -0,0 +1,20 @@

+ """add unique constraint for mock chroots

+ 

+ Revision ID: 4af9d157c4ea

+ Revises: 3b67c52f5277

+ Create Date: 2017-01-20 16:44:30.473253

+ 

+ """

+ 

+ # revision identifiers, used by Alembic.

+ revision = '4af9d157c4ea'

+ down_revision = '3b67c52f5277'

+ 

+ from alembic import op

+ import sqlalchemy as sa

+ 

+ def upgrade():

+     op.create_unique_constraint('mock_chroot_uniq', 'mock_chroot', ['os_release', 'os_version', 'arch'])

+ 

+ def downgrade():

+     op.drop_constraint('mock_chroot_uniq', 'mock_chroot', type_='unique')

@@ -766,6 +766,9 @@

      """

      Representation of mock chroot

      """

+     __table_args__ = (

+         db.UniqueConstraint('os_release', 'os_version', 'arch', name='mock_chroot_uniq'),

+     )

  

      id = db.Column(db.Integer, primary_key=True)

      # fedora/epel/..., mandatory

WARNING! This migration script fails if there are duplicates
already. Related to pull-request #27.

rebased

7 years ago

Pull-Request has been merged by praiskup

7 years ago

This broke quite a lot of tests. Could you please have a look at it?

Interesting, sorry for complication. Sure, I can have a look .. how can I reproduce the tests?

By running copr/frontend/run_tests.sh.

Proposed fix in pull-request/35