fix: add Parameter
model for lane_op
This commit is contained in:
parent
50351596ac
commit
2fe089bd57
|
@ -27,6 +27,24 @@ Common schema for operational data models
|
|||
import sqlalchemy as sa
|
||||
|
||||
|
||||
class ParameterBase:
|
||||
"""
|
||||
Base class for Parameter models, shared by Office + Lane.
|
||||
"""
|
||||
store_id = sa.Column(sa.SmallInteger(), primary_key=True, nullable=False)
|
||||
|
||||
lane_id = sa.Column(sa.SmallInteger(), primary_key=True, nullable=False)
|
||||
|
||||
param_key = sa.Column(sa.String(length=100), primary_key=True, nullable=False)
|
||||
|
||||
param_value = sa.Column(sa.String(length=255), nullable=True)
|
||||
|
||||
is_array = sa.Column(sa.Boolean(), nullable=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.store_id}-{self.lane_id} {self.param_key}"
|
||||
|
||||
|
||||
class EmployeeBase:
|
||||
"""
|
||||
Base class for Employee models, shared by Office + Lane.
|
||||
|
|
|
@ -33,6 +33,13 @@ from corepos.db.common import op as common
|
|||
Base = orm.declarative_base()
|
||||
|
||||
|
||||
class Parameter(common.ParameterBase, Base):
|
||||
"""
|
||||
Data model for ``parameters`` table.
|
||||
"""
|
||||
__tablename__ = 'parameters'
|
||||
|
||||
|
||||
class Employee(common.EmployeeBase, Base):
|
||||
"""
|
||||
Data model for ``employees`` table.
|
||||
|
|
|
@ -56,25 +56,12 @@ class StringableDateTime(sa.TypeDecorator):
|
|||
raise NotImplementedError
|
||||
|
||||
|
||||
class Parameter(Base):
|
||||
class Parameter(common.ParameterBase, Base):
|
||||
"""
|
||||
Represents a "parameter" value.
|
||||
Data model for ``parameters`` table.
|
||||
"""
|
||||
__tablename__ = 'parameters'
|
||||
|
||||
store_id = sa.Column(sa.SmallInteger(), primary_key=True, nullable=False)
|
||||
|
||||
lane_id = sa.Column(sa.SmallInteger(), primary_key=True, nullable=False)
|
||||
|
||||
param_key = sa.Column(sa.String(length=100), primary_key=True, nullable=False)
|
||||
|
||||
param_value = sa.Column(sa.String(length=255), nullable=True)
|
||||
|
||||
is_array = sa.Column(sa.Boolean(), nullable=True)
|
||||
|
||||
def __str__(self):
|
||||
return "{}-{} {}".format(self.store_id, self.lane_id, self.param_key)
|
||||
|
||||
|
||||
class TableSyncRule(Base):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue