mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-08 20:30:59 +00:00
fix(migrations): merge workspace revision heads
This commit is contained in:
+4
-4
@@ -1,7 +1,7 @@
|
||||
"""repair an ownerless local Workspace after tenancy migration
|
||||
|
||||
Revision ID: 0018_local_owner_repair
|
||||
Revises: 0016_agent_workspace, 0017_oss_workspace_identity
|
||||
Revision ID: 0017_local_owner_repair
|
||||
Revises: 0016_agent_workspace
|
||||
Create Date: 2026-07-31
|
||||
"""
|
||||
|
||||
@@ -14,8 +14,8 @@ import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
|
||||
revision = '0018_local_owner_repair'
|
||||
down_revision = ('0016_agent_workspace', '0017_oss_workspace_identity')
|
||||
revision = '0017_local_owner_repair'
|
||||
down_revision = '0016_agent_workspace'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
"""merge AgentRunner and OSS Workspace migration heads
|
||||
|
||||
Revision ID: 0018_merge_workspace_heads
|
||||
Revises: 0017_local_owner_repair, 0017_oss_workspace_identity
|
||||
Create Date: 2026-08-01
|
||||
"""
|
||||
|
||||
revision = '0018_merge_workspace_heads'
|
||||
down_revision = ('0017_local_owner_repair', '0017_oss_workspace_identity')
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
pass
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
pass
|
||||
@@ -180,6 +180,18 @@ async def test_workspace_upgrade_repairs_ownerless_existing_local_workspace(lega
|
||||
assert membership['status'] == 'active'
|
||||
|
||||
|
||||
async def test_published_owner_repair_revision_upgrades_to_merged_head(legacy_engine):
|
||||
await run_alembic_upgrade(legacy_engine, '0017_local_owner_repair')
|
||||
assert await get_alembic_current(legacy_engine) == '0017_local_owner_repair'
|
||||
|
||||
await run_alembic_upgrade(legacy_engine, 'head')
|
||||
|
||||
assert await get_alembic_current(legacy_engine) == get_alembic_head()
|
||||
async with legacy_engine.connect() as conn:
|
||||
workspace_uuid = await conn.scalar(sa.text("SELECT uuid FROM workspaces WHERE source = 'local'"))
|
||||
assert workspace_uuid == workspace_uuid_from_instance_id('instance_migration_test')
|
||||
|
||||
|
||||
async def test_existing_oss_workspace_is_rekeyed_to_instance_identity(tmp_path):
|
||||
engine = create_async_engine(f'sqlite+aiosqlite:///{tmp_path / "workspace-rekey.db"}')
|
||||
instance_id = 'instance_a711d9e4-0953-443f-a0e9-7dd50193a79f'
|
||||
|
||||
Reference in New Issue
Block a user