Skip to content
Snippets Groups Projects
Commit 0cb0114b authored by Karel van Klink's avatar Karel van Klink :smiley_cat: Committed by JORGE SASIAIN
Browse files

undo auto-formatting Alembic generated files

parent 1f0416e6
No related branches found
No related tags found
1 merge request!108NAT-315: Restore ISIS should be optional in migrate iptrunk
Showing with 520 additions and 1517 deletions
...@@ -32,10 +32,7 @@ def run_migrations_offline() -> None: ...@@ -32,10 +32,7 @@ def run_migrations_offline() -> None:
""" """
url = config.get_main_option("sqlalchemy.url") url = config.get_main_option("sqlalchemy.url")
context.configure( context.configure(
url=url, url=url, target_metadata=target_metadata, literal_binds=True, dialect_opts={"paramstyle": "named"}
target_metadata=target_metadata,
literal_binds=True,
dialect_opts={"paramstyle": "named"},
) )
with context.begin_transaction(): with context.begin_transaction():
......
...@@ -9,8 +9,8 @@ import sqlalchemy as sa ...@@ -9,8 +9,8 @@ import sqlalchemy as sa
from alembic import op from alembic import op
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = "3657611f0dfc" revision = '3657611f0dfc'
down_revision = "91047dd30b40" down_revision = '91047dd30b40'
branch_labels = None branch_labels = None
depends_on = None depends_on = None
...@@ -22,14 +22,14 @@ new_workflows = [ ...@@ -22,14 +22,14 @@ new_workflows = [
"name": "create_router", "name": "create_router",
"target": "CREATE", "target": "CREATE",
"description": "Create router", "description": "Create router",
"product_type": "Router", "product_type": "Router"
}, },
{ {
"name": "terminate_router", "name": "terminate_router",
"target": "TERMINATE", "target": "TERMINATE",
"description": "Terminate router", "description": "Terminate router",
"product_type": "Router", "product_type": "Router"
}, }
] ]
......
...@@ -9,8 +9,8 @@ import sqlalchemy as sa ...@@ -9,8 +9,8 @@ import sqlalchemy as sa
from alembic import op from alembic import op
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = "91047dd30b40" revision = '91047dd30b40'
down_revision = "97436160a422" down_revision = '97436160a422'
branch_labels = None branch_labels = None
depends_on = None depends_on = None
...@@ -22,7 +22,7 @@ new_workflows = [ ...@@ -22,7 +22,7 @@ new_workflows = [
"name": "create_site", "name": "create_site",
"target": "CREATE", "target": "CREATE",
"description": "Create Site", "description": "Create Site",
"product_type": "Site", "product_type": "Site"
} }
] ]
......
...@@ -9,8 +9,8 @@ import sqlalchemy as sa ...@@ -9,8 +9,8 @@ import sqlalchemy as sa
from alembic import op from alembic import op
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = "a6eefd32c4f7" revision = 'a6eefd32c4f7'
down_revision = "3657611f0dfc" down_revision = '3657611f0dfc'
branch_labels = None branch_labels = None
depends_on = None depends_on = None
...@@ -22,26 +22,26 @@ new_workflows = [ ...@@ -22,26 +22,26 @@ new_workflows = [
"name": "create_iptrunk", "name": "create_iptrunk",
"target": "CREATE", "target": "CREATE",
"description": "Create IP trunk", "description": "Create IP trunk",
"product_type": "Iptrunk", "product_type": "Iptrunk"
}, },
{ {
"name": "terminate_iptrunk", "name": "terminate_iptrunk",
"target": "TERMINATE", "target": "TERMINATE",
"description": "Terminate IPtrunk", "description": "Terminate IPtrunk",
"product_type": "Iptrunk", "product_type": "Iptrunk"
}, },
{ {
"name": "modify_trunk_interface", "name": "modify_trunk_interface",
"target": "MODIFY", "target": "MODIFY",
"description": "Modify IP Trunk interface", "description": "Modify IP Trunk interface",
"product_type": "Iptrunk", "product_type": "Iptrunk"
}, },
{ {
"name": "modify_isis_metric", "name": "modify_isis_metric",
"target": "MODIFY", "target": "MODIFY",
"description": "Modify IP trunk", "description": "Modify IP trunk",
"product_type": "Iptrunk", "product_type": "Iptrunk"
}, }
] ]
......
...@@ -9,8 +9,8 @@ import sqlalchemy as sa ...@@ -9,8 +9,8 @@ import sqlalchemy as sa
from alembic import op from alembic import op
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = "e68720f2ec32" revision = 'e68720f2ec32'
down_revision = "a6eefd32c4f7" down_revision = 'a6eefd32c4f7'
branch_labels = None branch_labels = None
depends_on = None depends_on = None
...@@ -22,7 +22,7 @@ new_workflows = [ ...@@ -22,7 +22,7 @@ new_workflows = [
"name": "migrate_iptrunk", "name": "migrate_iptrunk",
"target": "MODIFY", "target": "MODIFY",
"description": "Migrate an IP Trunk", "description": "Migrate an IP Trunk",
"product_type": "Iptrunk", "product_type": "Iptrunk"
} }
] ]
......
...@@ -9,162 +9,78 @@ import sqlalchemy as sa ...@@ -9,162 +9,78 @@ import sqlalchemy as sa
from alembic import op from alembic import op
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = "394dc60d5c02" revision = '394dc60d5c02'
down_revision = "01e42c100448" down_revision = '01e42c100448'
branch_labels = None branch_labels = None
depends_on = None depends_on = None
def upgrade() -> None: def upgrade() -> None:
conn = op.get_bind() conn = op.get_bind()
conn.execute( conn.execute(sa.text("""
sa.text(
"""
DELETE FROM product_block_resource_types WHERE product_block_resource_types.product_block_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkSideBlock')) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('iptrunk_side_ae_members_description')) DELETE FROM product_block_resource_types WHERE product_block_resource_types.product_block_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkSideBlock')) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('iptrunk_side_ae_members_description'))
""" """))
) conn.execute(sa.text("""
)
conn.execute(
sa.text(
"""
DELETE FROM subscription_instance_values USING product_block_resource_types WHERE subscription_instance_values.subscription_instance_id IN (SELECT subscription_instances.subscription_instance_id FROM subscription_instances WHERE subscription_instances.subscription_instance_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkSideBlock'))) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('iptrunk_side_ae_members_description')) DELETE FROM subscription_instance_values USING product_block_resource_types WHERE subscription_instance_values.subscription_instance_id IN (SELECT subscription_instances.subscription_instance_id FROM subscription_instances WHERE subscription_instances.subscription_instance_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkSideBlock'))) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('iptrunk_side_ae_members_description'))
""" """))
) conn.execute(sa.text("""
)
conn.execute(
sa.text(
"""
DELETE FROM product_block_resource_types WHERE product_block_resource_types.product_block_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkSideBlock')) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('iptrunk_side_ae_members')) DELETE FROM product_block_resource_types WHERE product_block_resource_types.product_block_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkSideBlock')) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('iptrunk_side_ae_members'))
""" """))
) conn.execute(sa.text("""
)
conn.execute(
sa.text(
"""
DELETE FROM subscription_instance_values USING product_block_resource_types WHERE subscription_instance_values.subscription_instance_id IN (SELECT subscription_instances.subscription_instance_id FROM subscription_instances WHERE subscription_instances.subscription_instance_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkSideBlock'))) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('iptrunk_side_ae_members')) DELETE FROM subscription_instance_values USING product_block_resource_types WHERE subscription_instance_values.subscription_instance_id IN (SELECT subscription_instances.subscription_instance_id FROM subscription_instances WHERE subscription_instances.subscription_instance_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkSideBlock'))) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('iptrunk_side_ae_members'))
""" """))
) conn.execute(sa.text("""
)
conn.execute(
sa.text(
"""
DELETE FROM subscription_instance_values WHERE subscription_instance_values.resource_type_id IN (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('iptrunk_side_ae_members_description', 'iptrunk_side_ae_members')) DELETE FROM subscription_instance_values WHERE subscription_instance_values.resource_type_id IN (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('iptrunk_side_ae_members_description', 'iptrunk_side_ae_members'))
""" """))
) conn.execute(sa.text("""
)
conn.execute(
sa.text(
"""
DELETE FROM resource_types WHERE resource_types.resource_type IN ('iptrunk_side_ae_members_description', 'iptrunk_side_ae_members') DELETE FROM resource_types WHERE resource_types.resource_type IN ('iptrunk_side_ae_members_description', 'iptrunk_side_ae_members')
""" """))
) conn.execute(sa.text("""
)
conn.execute(
sa.text(
"""
INSERT INTO product_blocks (name, description, tag, status) VALUES ('IptrunkInterfaceBlock', 'Interface in a LAG as part of an IP trunk', 'IPTINT', 'active') RETURNING product_blocks.product_block_id INSERT INTO product_blocks (name, description, tag, status) VALUES ('IptrunkInterfaceBlock', 'Interface in a LAG as part of an IP trunk', 'IPTINT', 'active') RETURNING product_blocks.product_block_id
""" """))
) conn.execute(sa.text("""
)
conn.execute(
sa.text(
"""
INSERT INTO resource_types (resource_type, description) VALUES ('interface_description', 'Description of a LAG interface') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('interface_description', 'Description of a LAG interface') RETURNING resource_types.resource_type_id
""" """))
) conn.execute(sa.text("""
)
conn.execute(
sa.text(
"""
INSERT INTO resource_types (resource_type, description) VALUES ('interface_name', 'Interface name of a LAG member') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('interface_name', 'Interface name of a LAG member') RETURNING resource_types.resource_type_id
""" """))
) conn.execute(sa.text("""
)
conn.execute(
sa.text(
"""
INSERT INTO product_block_relations (in_use_by_id, depends_on_id) VALUES ((SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkSideBlock')), (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock'))) INSERT INTO product_block_relations (in_use_by_id, depends_on_id) VALUES ((SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkSideBlock')), (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock')))
""" """))
) conn.execute(sa.text("""
)
conn.execute(
sa.text(
"""
INSERT INTO product_block_resource_types (product_block_id, resource_type_id) VALUES ((SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock')), (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('interface_description'))) INSERT INTO product_block_resource_types (product_block_id, resource_type_id) VALUES ((SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock')), (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('interface_description')))
""" """))
) conn.execute(sa.text("""
)
conn.execute(
sa.text(
"""
INSERT INTO product_block_resource_types (product_block_id, resource_type_id) VALUES ((SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock')), (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('interface_name'))) INSERT INTO product_block_resource_types (product_block_id, resource_type_id) VALUES ((SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock')), (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('interface_name')))
""" """))
)
)
def downgrade() -> None: def downgrade() -> None:
conn = op.get_bind() conn = op.get_bind()
conn.execute( conn.execute(sa.text("""
sa.text(
"""
DELETE FROM product_block_resource_types WHERE product_block_resource_types.product_block_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock')) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('interface_description')) DELETE FROM product_block_resource_types WHERE product_block_resource_types.product_block_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock')) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('interface_description'))
""" """))
) conn.execute(sa.text("""
)
conn.execute(
sa.text(
"""
DELETE FROM subscription_instance_values USING product_block_resource_types WHERE subscription_instance_values.subscription_instance_id IN (SELECT subscription_instances.subscription_instance_id FROM subscription_instances WHERE subscription_instances.subscription_instance_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock'))) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('interface_description')) DELETE FROM subscription_instance_values USING product_block_resource_types WHERE subscription_instance_values.subscription_instance_id IN (SELECT subscription_instances.subscription_instance_id FROM subscription_instances WHERE subscription_instances.subscription_instance_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock'))) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('interface_description'))
""" """))
) conn.execute(sa.text("""
)
conn.execute(
sa.text(
"""
DELETE FROM product_block_resource_types WHERE product_block_resource_types.product_block_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock')) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('interface_name')) DELETE FROM product_block_resource_types WHERE product_block_resource_types.product_block_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock')) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('interface_name'))
""" """))
) conn.execute(sa.text("""
)
conn.execute(
sa.text(
"""
DELETE FROM subscription_instance_values USING product_block_resource_types WHERE subscription_instance_values.subscription_instance_id IN (SELECT subscription_instances.subscription_instance_id FROM subscription_instances WHERE subscription_instances.subscription_instance_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock'))) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('interface_name')) DELETE FROM subscription_instance_values USING product_block_resource_types WHERE subscription_instance_values.subscription_instance_id IN (SELECT subscription_instances.subscription_instance_id FROM subscription_instances WHERE subscription_instances.subscription_instance_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock'))) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('interface_name'))
""" """))
) conn.execute(sa.text("""
)
conn.execute(
sa.text(
"""
DELETE FROM subscription_instance_values WHERE subscription_instance_values.resource_type_id IN (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('interface_description', 'interface_name')) DELETE FROM subscription_instance_values WHERE subscription_instance_values.resource_type_id IN (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('interface_description', 'interface_name'))
""" """))
) conn.execute(sa.text("""
)
conn.execute(
sa.text(
"""
DELETE FROM resource_types WHERE resource_types.resource_type IN ('interface_description', 'interface_name') DELETE FROM resource_types WHERE resource_types.resource_type IN ('interface_description', 'interface_name')
""" """))
) conn.execute(sa.text("""
)
conn.execute(
sa.text(
"""
DELETE FROM product_block_relations WHERE product_block_relations.in_use_by_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkSideBlock')) AND product_block_relations.depends_on_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock')) DELETE FROM product_block_relations WHERE product_block_relations.in_use_by_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkSideBlock')) AND product_block_relations.depends_on_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock'))
""" """))
) conn.execute(sa.text("""
)
conn.execute(
sa.text(
"""
DELETE FROM subscription_instances WHERE subscription_instances.product_block_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock')) DELETE FROM subscription_instances WHERE subscription_instances.product_block_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock'))
""" """))
) conn.execute(sa.text("""
)
conn.execute(
sa.text(
"""
DELETE FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock') DELETE FROM product_blocks WHERE product_blocks.name IN ('IptrunkInterfaceBlock')
""" """))
)
)
...@@ -16,18 +16,8 @@ branch_labels = None ...@@ -16,18 +16,8 @@ branch_labels = None
depends_on = None depends_on = None
new_workflows = [ new_workflows = [
{ {"name": "modify_site", "target": "MODIFY", "description": "Modify site", "product_type": "Site"},
"name": "modify_site", {"name": "terminate_site", "target": "TERMINATE", "description": "Terminate site", "product_type": "Site"},
"target": "MODIFY",
"description": "Modify site",
"product_type": "Site",
},
{
"name": "terminate_site",
"target": "TERMINATE",
"description": "Terminate site",
"product_type": "Site",
},
] ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment