Commit 6ebdc37e authored by sim's avatar sim

Add Node.NAME_MAXLEN constant

parent 83934674
......@@ -51,6 +51,8 @@ class Node(ValidatorMixin, Base):
>>> session.query(UserNode).filter_by(typename='USER').delete() # doctest: +SKIP
# Right: only user nodes are deleted.
"""
NAME_MAXLEN = 255
__tablename__ = 'nodes'
__table_args__ = (
Index('nodes_user_id_typename_parent_id_idx', 'user_id', 'typename', 'parent_id'),
......@@ -70,7 +72,7 @@ class Node(ValidatorMixin, Base):
parent_id = Column(Integer, ForeignKey('nodes.id', ondelete='CASCADE'))
parent = relationship('Node', remote_side=[id])
name = Column(String(255), nullable=False, server_default='')
name = Column(String(NAME_MAXLEN), nullable=False, server_default='')
date = Column(DateTime(timezone=True), nullable=False,
server_default=text('CURRENT_TIMESTAMP'))
......
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