Commit 44249b92 authored by Etienne Allovon's avatar Etienne Allovon

3386 - add primary key and standardize the column name

parent c083ab21
......@@ -19,9 +19,6 @@ from sqlalchemy.schema import Column, ForeignKeyConstraint, PrimaryKeyConstraint
from sqlalchemy.types import Integer, String
from sqlalchemy.orm import relationship
from xivo_dao.alchemy.labels import Labels
from xivo_dao.alchemy.userfeatures import UserFeatures
from xivo_dao.helpers.db_manager import Base
......@@ -29,16 +26,14 @@ class UserLabels(Base):
__tablename__ = 'userlabels'
__table_args__ = (
ForeignKeyConstraint(('userid',),
PrimaryKeyConstraint('user_id', 'label_id'),
ForeignKeyConstraint(('user_id',),
('userfeatures.id',),
ondelete='RESTRICT'),
ForeignKeyConstraint(('labelid',),
ForeignKeyConstraint(('label_id',),
('labels.id',),
ondelete='RESTRICT'),
)
userid = Column(Integer, nullable=False)
labelid = Column(Integer, nullable=False)
label = relationship(Labels)
user_id = Column(Integer, nullable=False)
label_id = Column(Integer, nullable=False)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment