teoat commited on
Commit
58a8e48
·
verified ·
1 Parent(s): f121445

Upload core/eav/models.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. core/eav/models.py +9 -3
core/eav/models.py CHANGED
@@ -23,7 +23,9 @@ class EAVEntity(Base):
23
  created_at = Column(DateTime, default=utc_now)
24
  updated_at = Column(DateTime, default=utc_now, onupdate=utc_now)
25
 
26
- values = relationship("EAVValue", back_populates="entity", cascade="all, delete-orphan")
 
 
27
 
28
 
29
  class EAVAttribute(Base):
@@ -31,7 +33,9 @@ class EAVAttribute(Base):
31
 
32
  attribute_id = Column(String, primary_key=True, default=lambda: str(uuid.uuid4()))
33
  attribute_name = Column(String, unique=True, nullable=False, index=True)
34
- data_type = Column(String, nullable=False) # 'text', 'numeric', 'boolean', 'json', 'date'
 
 
35
  description = Column(Text)
36
  is_required = Column(Boolean, default=False)
37
 
@@ -52,4 +56,6 @@ class EAVValue(Base):
52
  entity = relationship("EAVEntity", back_populates="values")
53
  attribute = relationship("EAVAttribute")
54
 
55
- __table_args__ = (Index("idx_eav_entity_attribute", "entity_id", "attribute_id", unique=True),)
 
 
 
23
  created_at = Column(DateTime, default=utc_now)
24
  updated_at = Column(DateTime, default=utc_now, onupdate=utc_now)
25
 
26
+ values = relationship(
27
+ "EAVValue", back_populates="entity", cascade="all, delete-orphan"
28
+ )
29
 
30
 
31
  class EAVAttribute(Base):
 
33
 
34
  attribute_id = Column(String, primary_key=True, default=lambda: str(uuid.uuid4()))
35
  attribute_name = Column(String, unique=True, nullable=False, index=True)
36
+ data_type = Column(
37
+ String, nullable=False
38
+ ) # 'text', 'numeric', 'boolean', 'json', 'date'
39
  description = Column(Text)
40
  is_required = Column(Boolean, default=False)
41
 
 
56
  entity = relationship("EAVEntity", back_populates="values")
57
  attribute = relationship("EAVAttribute")
58
 
59
+ __table_args__ = (
60
+ Index("idx_eav_entity_attribute", "entity_id", "attribute_id", unique=True),
61
+ )