perf(workflow): batch revision reads and add bounded histories
This commit is contained in:
@@ -29,7 +29,7 @@ class WorkflowMigrationTests(unittest.TestCase):
|
||||
try:
|
||||
with engine.connect() as connection:
|
||||
self.assertIn(
|
||||
"8d5a2f7c1b4e",
|
||||
"9e6b3f8a2c7d",
|
||||
set(MigrationContext.configure(connection).get_current_heads()),
|
||||
)
|
||||
self.assertEqual(
|
||||
@@ -75,6 +75,18 @@ class WorkflowMigrationTests(unittest.TestCase):
|
||||
)
|
||||
}
|
||||
self.assertIn("start_origin", instance_columns)
|
||||
indexes = {
|
||||
item["name"]: item["column_names"]
|
||||
for item in inspect(connection).get_indexes("workflow_instances")
|
||||
}
|
||||
self.assertEqual(
|
||||
["tenant_id", "created_at", "id"],
|
||||
indexes["ix_workflow_instances_tenant_created_id"],
|
||||
)
|
||||
self.assertEqual(
|
||||
["tenant_id", "definition_id", "created_at", "id"],
|
||||
indexes["ix_workflow_instances_tenant_definition_created_id"],
|
||||
)
|
||||
definition_columns = {
|
||||
item["name"]
|
||||
for item in inspect(connection).get_columns(
|
||||
@@ -107,6 +119,7 @@ class WorkflowMigrationTests(unittest.TestCase):
|
||||
"b2e4f6a8c0d1_",
|
||||
"e4a1f8c2d7b6_",
|
||||
"8d5a2f7c1b4e_",
|
||||
"9e6b3f8a2c7d_",
|
||||
)
|
||||
):
|
||||
continue
|
||||
@@ -151,7 +164,7 @@ class WorkflowMigrationTests(unittest.TestCase):
|
||||
manifest_factories=(get_manifest,),
|
||||
)
|
||||
|
||||
self.assertIn("8d5a2f7c1b4e", result.current_revision or "")
|
||||
self.assertIn("9e6b3f8a2c7d", result.current_revision or "")
|
||||
engine = create_engine(url)
|
||||
try:
|
||||
upgraded_tables = set(inspect(engine).get_table_names())
|
||||
@@ -187,6 +200,8 @@ class WorkflowMigrationTests(unittest.TestCase):
|
||||
try:
|
||||
with engine.begin() as connection:
|
||||
for index_name in (
|
||||
"ix_workflow_instances_tenant_created_id",
|
||||
"ix_workflow_instances_tenant_definition_created_id",
|
||||
"ix_workflow_instance_steps_work_assignment",
|
||||
"ix_workflow_instance_steps_work_due_at",
|
||||
"ix_workflow_instance_steps_work_assignment_id",
|
||||
@@ -220,7 +235,7 @@ class WorkflowMigrationTests(unittest.TestCase):
|
||||
connection.execute(
|
||||
text(
|
||||
"UPDATE alembic_version SET version_num = "
|
||||
"'b2e4f6a8c0d1' WHERE version_num = '8d5a2f7c1b4e'"
|
||||
"'b2e4f6a8c0d1' WHERE version_num = '9e6b3f8a2c7d'"
|
||||
)
|
||||
)
|
||||
finally:
|
||||
@@ -258,7 +273,7 @@ class WorkflowMigrationTests(unittest.TestCase):
|
||||
)
|
||||
with engine.connect() as connection:
|
||||
self.assertIn(
|
||||
"8d5a2f7c1b4e",
|
||||
"9e6b3f8a2c7d",
|
||||
set(MigrationContext.configure(connection).get_current_heads()),
|
||||
)
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user