improve: change db schema for settings
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import Column, String, Integer, ForeignKey, UniqueConstraint, text
|
||||
from sqlalchemy import Column, String, Integer, ForeignKey, UniqueConstraint
|
||||
from db.models import Base
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ class Path(Base):
|
||||
name = Column(String(50), nullable=False)
|
||||
parent_id = Column(Integer, ForeignKey("path.id"), nullable=True)
|
||||
order = Column(String(36), default=lambda: str(uuid.uuid4()))
|
||||
setting_id = Column(Integer, ForeignKey("path_settings.id"), nullable=True)
|
||||
__table_args__ = (UniqueConstraint("parent_id", "name", name="unique_parent_id_name"), )
|
||||
def to_dict(self):
|
||||
return {
|
||||
@@ -17,6 +18,7 @@ class Path(Base):
|
||||
"name": self.name,
|
||||
"parent_id": self.parent_id,
|
||||
"order": self.order,
|
||||
"setting_id": self.setting_id
|
||||
}
|
||||
|
||||
__payload__ = {
|
||||
|
||||
Reference in New Issue
Block a user