Commit ec481c60 authored by Tomas Taraba's avatar Tomas Taraba

3386 Define fks and relationship using built-in methods in table userlabels

parent d45def75
......@@ -14,10 +14,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <>
from sqlalchemy.schema import Column, ForeignKeyConstraint, PrimaryKeyConstraint
from sqlalchemy.types import Integer, String
from sqlalchemy.orm import relationship
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship, backref
from sqlalchemy.schema import Column
from sqlalchemy.types import Integer
from xivo_dao.helpers.db_manager import Base
......@@ -25,15 +25,10 @@ from xivo_dao.helpers.db_manager import Base
class UserLabels(Base):
__tablename__ = 'userlabels'
__table_args__ = (
PrimaryKeyConstraint('user_id', 'label_id'),
user_id = Column(Integer, nullable=False)
label_id = Column(Integer, nullable=False)
\ No newline at end of file
id = Column(Integer, primary_key=True)
user_id = Column(Integer, ForeignKey('', ondelete='RESTRICT'))
label_id = Column(Integer, ForeignKey('', ondelete='RESTRICT'))
user_features = relationship("UserFeatures", backref=backref("userlabels"))
labels = relationship("Labels", backref=backref("userlabels"))
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