Commit c083ab21 authored by Laurent Meiller's avatar Laurent Meiller

3386 WIP still issue with tests...

parent 7f878d45
......@@ -20,6 +20,7 @@
from xivo_dao.alchemy.cti_profile import CtiProfile
from xivo_dao.alchemy.extension import Extension
from xivo_dao.alchemy.linefeatures import LineFeatures
from xivo_dao.alchemy.userlabels import UserLabels
from xivo_dao.alchemy.user_line import UserLine
from xivo_dao.alchemy.userfeatures import UserFeatures
from xivo_dao.alchemy.voicemail import Voicemail
......@@ -67,6 +67,7 @@ from xivo_dao.alchemy.groupfeatures import GroupFeatures
from xivo_dao.alchemy.iaxcallnumberlimits import IAXCallNumberLimits
from xivo_dao.alchemy.incall import Incall
from xivo_dao.alchemy.infos import Infos
from xivo_dao.alchemy.labels import Labels
from xivo_dao.alchemy.ldapfilter import LdapFilter
from xivo_dao.alchemy.ldapserver import LdapServer
from xivo_dao.alchemy.linefeatures import LineFeatures
......@@ -136,6 +137,7 @@ from xivo_dao.alchemy.user_line import UserLine
from xivo_dao.alchemy.usercustom import UserCustom
from xivo_dao.alchemy.userfeatures import UserFeatures
from xivo_dao.alchemy.useriax import UserIAX
from xivo_dao.alchemy.userlabels import UserLabels
from xivo_dao.alchemy.users import Users
from xivo_dao.alchemy.usersip import UserSIP
from xivo_dao.alchemy.voicemail import Voicemail
......
......@@ -24,7 +24,7 @@ from xivo_dao.helpers.db_manager import Base
class Labels(Base):
__tablename__ = 'labels'
__table_args__ = (
PrimaryKeyConstraint('id')
PrimaryKeyConstraint('id'),
)
id = Column(Integer, nullable=False, autoincrement=True)
......
......@@ -32,7 +32,6 @@ from xivo_dao.alchemy import enum
from xivo_dao.alchemy.cti_profile import CtiProfile
from xivo_dao.alchemy.entity import Entity
from xivo_dao.alchemy.func_key_template import FuncKeyTemplate
from xivo_dao.alchemy.userlabels import UserLabels
from xivo_dao.helpers.db_manager import Base
......@@ -144,7 +143,7 @@ class UserFeatures(Base):
UserLine.main_line == True)""")
voicemail = relationship("Voicemail")
cti_profile = relationship("CtiProfile")
labels = relationship("Label", secondary=UserLabels)
labels = relationship("UserLabels")
def extrapolate_caller_id(self, extension=None):
......
......@@ -19,9 +19,8 @@ from sqlalchemy.schema import Column, ForeignKeyConstraint, PrimaryKeyConstraint
from sqlalchemy.types import Integer, String
from sqlalchemy.orm import relationship
from xivo_dao.alchemy.userfeatures import UserFeatures
from xivo_dao.alchemy.labels import Labels
from xivo_dao.alchemy.userfeatures import UserFeatures
from xivo_dao.helpers.db_manager import Base
......@@ -30,13 +29,16 @@ class UserLabels(Base):
__tablename__ = 'userlabels'
__table_args__ = (
ForeignKeyConstraint(('user_id',),
ForeignKeyConstraint(('userid',),
('userfeatures.id',),
ondelete='RESTRICT'),
ForeignKeyConstraint(('label_id',),
ForeignKeyConstraint(('labelid',),
('labels.id',),
ondelete='RESTRICT'),
)
users = relationship(UserFeatures)
labels = relationship(Labels)
userid = Column(Integer, nullable=False)
labelid = Column(Integer, nullable=False)
label = relationship(Labels)
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