add script blocks table (#3125)
This commit is contained in:
@@ -48,6 +48,7 @@ PERSISTENT_BROWSER_SESSION_ID = "pbs"
|
||||
SCRIPT_FILE_PREFIX = "sf"
|
||||
SCRIPT_REVISION_PREFIX = "sr"
|
||||
SCRIPT_PREFIX = "s"
|
||||
SCRIPT_BLOCK_PREFIX = "sb"
|
||||
STEP_PREFIX = "stp"
|
||||
TASK_GENERATION_PREFIX = "tg"
|
||||
TASK_PREFIX = "tsk"
|
||||
@@ -227,6 +228,11 @@ def generate_script_file_id() -> str:
|
||||
return f"{SCRIPT_FILE_PREFIX}_{int_id}"
|
||||
|
||||
|
||||
def generate_script_block_id() -> str:
|
||||
int_id = generate_id()
|
||||
return f"{SCRIPT_BLOCK_PREFIX}_{int_id}"
|
||||
|
||||
|
||||
############# Helper functions below ##############
|
||||
def generate_id() -> int:
|
||||
"""
|
||||
|
||||
@@ -35,6 +35,7 @@ from skyvern.forge.sdk.db.id import (
|
||||
generate_organization_bitwarden_collection_id,
|
||||
generate_output_parameter_id,
|
||||
generate_persistent_browser_session_id,
|
||||
generate_script_block_id,
|
||||
generate_script_file_id,
|
||||
generate_script_id,
|
||||
generate_script_revision_id,
|
||||
@@ -861,3 +862,24 @@ class WorkflowScriptModel(Base):
|
||||
nullable=False,
|
||||
)
|
||||
deleted_at = Column(DateTime, nullable=True)
|
||||
|
||||
|
||||
class ScriptBlockModel(Base):
|
||||
__tablename__ = "script_blocks"
|
||||
__table_args__ = (
|
||||
UniqueConstraint(
|
||||
"script_revision_id",
|
||||
"script_block_label",
|
||||
name="uc_script_revision_id_script_block_label",
|
||||
),
|
||||
)
|
||||
|
||||
script_block_id = Column(String, primary_key=True, default=generate_script_block_id)
|
||||
script_id = Column(String, nullable=False)
|
||||
script_revision_id = Column(String, nullable=False, index=True)
|
||||
script_block_label = Column(String, nullable=False)
|
||||
script_file_id = Column(String, nullable=False)
|
||||
|
||||
created_at = Column(DateTime, default=datetime.datetime.utcnow, nullable=False)
|
||||
modified_at = Column(DateTime, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow, nullable=False)
|
||||
deleted_at = Column(DateTime, nullable=True)
|
||||
|
||||
Reference in New Issue
Block a user