fixing unique secondary and owner
This commit is contained in:
parent
ac032c7902
commit
8d6e50ece9
|
@ -24,9 +24,13 @@ def get_inv():
|
|||
|
||||
def upgrade():
|
||||
op.drop_constraint('one tag id per organization', 'tag', schema=f'{get_inv()}')
|
||||
op.drop_constraint('one secondary tag per organization', 'tag', schema=f'{get_inv()}')
|
||||
op.create_primary_key('one tag id per owner', 'tag', ['id', 'owner_id'], schema=f'{get_inv()}'),
|
||||
op.create_unique_constraint('one secondary tag per owner', 'tag', ['secondary', 'owner_id'], schema=f'{get_inv()}'),
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_constraint('one tag id per owner', 'tag', schema=f'{get_inv()}')
|
||||
op.drop_constraint('one secondary tag per owner', 'tag', schema=f'{get_inv()}')
|
||||
op.create_primary_key('one tag id per organization', 'tag', ['id', 'org_id'], schema=f'{get_inv()}'),
|
||||
op.create_unique_constraint('one secondary tag per organization', 'tag', ['secondary', 'org_id'], schema=f'{get_inv()}'),
|
||||
|
|
|
@ -98,7 +98,7 @@ class Tag(Thing):
|
|||
|
||||
__table_args__ = (
|
||||
UniqueConstraint(id, owner_id, name='one tag id per owner'),
|
||||
UniqueConstraint(secondary, org_id, name='one secondary tag per organization')
|
||||
UniqueConstraint(secondary, owner_id, name='one secondary tag per organization')
|
||||
)
|
||||
|
||||
@property
|
||||
|
|
Reference in a new issue