forked from platypush/platypush
[#341] Added ProcedureType
enum.
This commit is contained in:
parent
d9916873cb
commit
e593264eab
1 changed files with 15 additions and 2 deletions
|
@ -1,8 +1,9 @@
|
||||||
import logging
|
import logging
|
||||||
|
from enum import Enum
|
||||||
|
|
||||||
from sqlalchemy import (
|
from sqlalchemy import (
|
||||||
Column,
|
Column,
|
||||||
Enum,
|
Enum as DbEnum,
|
||||||
ForeignKey,
|
ForeignKey,
|
||||||
Integer,
|
Integer,
|
||||||
JSON,
|
JSON,
|
||||||
|
@ -16,6 +17,12 @@ from . import Entity
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class ProcedureType(Enum):
|
||||||
|
PYTHON = 'python'
|
||||||
|
CONFIG = 'config'
|
||||||
|
DB = 'db'
|
||||||
|
|
||||||
|
|
||||||
if not is_defined('procedure'):
|
if not is_defined('procedure'):
|
||||||
|
|
||||||
class Procedure(Entity):
|
class Procedure(Entity):
|
||||||
|
@ -30,7 +37,13 @@ if not is_defined('procedure'):
|
||||||
)
|
)
|
||||||
args = Column(JSON, nullable=False, default=[])
|
args = Column(JSON, nullable=False, default=[])
|
||||||
procedure_type = Column(
|
procedure_type = Column(
|
||||||
Enum('python', 'config', name='procedure_type'), nullable=False
|
DbEnum(
|
||||||
|
*[m.value for m in ProcedureType.__members__.values()],
|
||||||
|
name='procedure_type',
|
||||||
|
create_constraint=True,
|
||||||
|
validate_strings=True,
|
||||||
|
),
|
||||||
|
nullable=False,
|
||||||
)
|
)
|
||||||
module = Column(String)
|
module = Column(String)
|
||||||
source = Column(String)
|
source = Column(String)
|
||||||
|
|
Loading…
Reference in a new issue