def _create_inter_deployment_dependencies_table(): op.create_table( 'inter_deployment_dependencies', sa.Column('_storage_id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('id', sa.Text(), nullable=True), sa.Column('visibility', VISIBILITY_ENUM, nullable=True), sa.Column('created_at', storage.models_base.UTCDateTime(), nullable=False), sa.Column('dependency_creator', sa.Text(), nullable=False), sa.Column('target_deployment_func', JSONString(), nullable=True), sa.Column('_source_deployment', sa.Integer(), nullable=True), sa.Column('_target_deployment', sa.Integer(), nullable=True), sa.Column('_tenant_id', sa.Integer(), nullable=False), sa.Column('_creator_id', sa.Integer(), nullable=False), sa.Column('external_source', JSONString(), nullable=True), sa.Column('external_target', JSONString(), nullable=True), sa.ForeignKeyConstraint( ['_creator_id'], [u'users.id'], name=op.f('inter_deployment_dependencies__creator_id_fkey'), ondelete='CASCADE'), sa.ForeignKeyConstraint( ['_source_deployment'], [u'deployments._storage_id'], name=op.f('inter_deployment_dependencies__source_deployment_fkey'), ondelete='CASCADE'), sa.ForeignKeyConstraint( ['_target_deployment'], [u'deployments._storage_id'], name=op.f('inter_deployment_dependencies__target_deployment_fkey'), ondelete='SET NULL'), sa.ForeignKeyConstraint( ['_tenant_id'], [u'tenants.id'], name=op.f('inter_deployment_dependencies__tenant_id_fkey'), ondelete='CASCADE'), sa.PrimaryKeyConstraint( '_storage_id', name=op.f('inter_deployment_dependencies_pkey')), ) op.create_index(op.f('inter_deployment_dependencies__tenant_id_idx'), 'inter_deployment_dependencies', ['_tenant_id'], unique=False) op.create_index(op.f('inter_deployment_dependencies_created_at_idx'), 'inter_deployment_dependencies', ['created_at'], unique=False) op.create_index(op.f('inter_deployment_dependencies_id_idx'), 'inter_deployment_dependencies', ['id'], unique=True) op.add_column( u'deployment_updates', sa.Column('keep_old_deployment_dependencies', sa.Boolean(), nullable=False))
class Config(Base): __tablename__ = 'config' name = sa.Column(sa.Text, primary_key=True) value = sa.Column(JSONString(), nullable=False) schema = sa.Column(JSONString(), nullable=True) is_editable = sa.Column(sa.Boolean, default=True) updated_at = sa.Column(UTCDateTime()) scope = sa.Column(sa.Text, primary_key=True) _updater_id = sa.Column( sa.Integer, sa.ForeignKey(User.id, ondelete='SET NULL'), nullable=True, index=False, primary_key=False, )
def create_filters_table(): op.create_table( 'filters', sa.Column('_storage_id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('id', sa.Text(), nullable=True), sa.Column('value', JSONString(), nullable=True), sa.Column('visibility', VISIBILITY_ENUM, nullable=True), sa.Column('created_at', UTCDateTime(), nullable=False), sa.Column('updated_at', UTCDateTime(), nullable=True), sa.Column('_tenant_id', sa.Integer(), nullable=False), sa.Column('_creator_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['_creator_id'], [u'users.id'], name=op.f('filters__creator_id_fkey'), ondelete='CASCADE'), sa.ForeignKeyConstraint(['_tenant_id'], [u'tenants.id'], name=op.f('filters__tenant_id_fkey'), ondelete='CASCADE'), sa.PrimaryKeyConstraint('_storage_id', name=op.f('filters_pkey')), ) op.create_index(op.f('filters__tenant_id_idx'), 'filters', ['_tenant_id'], unique=False) op.create_index(op.f('filters_created_at_idx'), 'filters', ['created_at'], unique=False) op.create_index(op.f('filters_id_idx'), 'filters', ['id'], unique=False) op.create_index(op.f('filters__creator_id_idx'), 'filters', ['_creator_id'], unique=False) op.create_index(op.f('filters_visibility_idx'), 'filters', ['visibility'], unique=False) op.create_index('filters_id__tenant_id_idx', 'filters', ['id', '_tenant_id'], unique=True)
def upgrade(): op.add_column('executions', sa.Column('token', sa.String(length=100), nullable=True)) bind = op.get_bind() session = orm.Session(bind=bind) Config.__table__.create(bind) session.add_all([ Config(name='rest_service_log_path', value='/var/log/cloudify/rest/cloudify-rest-service.log', scope='rest', schema=None, is_editable=False), Config(name='rest_service_log_level', value='INFO', scope='rest', schema={ 'type': 'string', 'enum': LOG_LEVELS_ENUM }, is_editable=True), Config(name='ldap_server', value=None, scope='rest', schema={'type': 'string'}, is_editable=True), Config(name='ldap_username', value=None, scope='rest', schema={'type': 'string'}, is_editable=True), Config(name='ldap_password', value=None, scope='rest', schema={'type': 'string'}, is_editable=True), Config(name='ldap_domain', value=None, scope='rest', schema={'type': 'string'}, is_editable=True), Config(name='ldap_is_active_directory', value=None, scope='rest', schema={'type': 'boolean'}, is_editable=True), Config(name='ldap_dn_extra', value=None, scope='rest', schema=None, is_editable=True), Config(name='ldap_timeout', value=5.0, scope='rest', schema={'type': 'number'}, is_editable=True), Config(name='ldap_nested_levels', value=1, scope='rest', schema={ 'type': 'number', 'minimum': 1 }, is_editable=True), Config(name='file_server_root', value='/opt/manager/resources', scope='rest', schema=None, is_editable=False), Config(name='file_server_url', value='http://127.0.0.1:53333/resources', scope='rest', schema=None, is_editable=False), Config(name='insecure_endpoints_disabled', value=True, scope='rest', schema={'type': 'boolean'}, is_editable=False), Config(name='maintenance_folder', value='/opt/manager/maintenance', scope='rest', schema=None, is_editable=False), Config(name='min_available_memory_mb', value=100, scope='rest', schema={ 'type': 'number', 'minimum': 0 }, is_editable=True), Config(name='failed_logins_before_account_lock', value=4, scope='rest', schema={ 'type': 'number', 'minimum': 1 }, is_editable=True), Config(name='account_lock_period', value=-1, scope='rest', schema={ 'type': 'number', 'minimum': -1 }, is_editable=True), Config(name='public_ip', value=None, scope='rest', schema=None, is_editable=False), Config(name='default_page_size', value=1000, scope='rest', schema={ 'type': 'number', 'minimum': 1 }, is_editable=True), Config(name='max_workers', value=5, scope='mgmtworker', schema={ 'type': 'number', 'minimum': 1 }, is_editable=True), Config(name='min_workers', value=2, scope='mgmtworker', schema={ 'type': 'number', 'minimum': 1 }, is_editable=True), Config(name='broker_port', value=5671, scope='agent', schema={ 'type': 'number', 'minimum': 1, 'maximum': 65535 }, is_editable=True), Config(name='min_workers', value=2, scope='agent', schema={ 'type': 'number', 'minimum': 1 }, is_editable=True), Config(name='max_workers', value=5, scope='agent', schema={ 'type': 'number', 'minimum': 1 }, is_editable=True), Config(name='heartbeat', value=30, scope='agent', schema={ 'type': 'number', 'minimum': 0 }, is_editable=True), Config(name='log_level', value='info', scope='agent', schema={ 'type': 'string', 'enum': LOG_LEVELS_ENUM }), Config( name='task_retries', value=60, scope='workflow', schema={ 'type': 'number', 'minimum': -1 }, ), Config( name='task_retry_interval', value=15, scope='workflow', schema={ 'type': 'number', 'minimum': 0 }, ), Config( name='subgraph_retries', value=0, scope='workflow', schema={ 'type': 'number', 'minimum': -1 }, ) ]) session.commit() op.create_table( 'certificates', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('name', sa.Text(), unique=True, nullable=False), sa.Column('value', sa.Text(), unique=False, nullable=False), sa.Column('updated_at', UTCDateTime(), nullable=True), sa.Column('_updater_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['_updater_id'], [u'users.id'], ondelete='SET NULL'), sa.PrimaryKeyConstraint('id', name=op.f('certificates_pkey'))) op.create_table( 'managers', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('hostname', sa.Text(), unique=True, nullable=False), sa.Column('private_ip', sa.Text(), unique=True, nullable=False), sa.Column('public_ip', sa.Text(), unique=True, nullable=False), sa.Column('version', sa.Text(), nullable=False), sa.Column('edition', sa.Text(), nullable=False), sa.Column('distribution', sa.Text(), nullable=False), sa.Column('distro_release', sa.Text(), nullable=False), sa.Column('fs_sync_node_id', sa.Text(), nullable=True), sa.Column('networks', JSONString(), nullable=True), sa.Column('_ca_cert_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['_ca_cert_id'], [u'certificates.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id', name=op.f('managers_pkey'))) op.create_table( 'rabbitmq_brokers', sa.Column('name', sa.Text(), nullable=False), sa.Column('host', sa.Text(), nullable=False), sa.Column('management_host', sa.Text(), nullable=True), sa.Column('port', sa.Integer()), sa.Column('username', sa.Text(), nullable=True), sa.Column('password', sa.Text(), nullable=True), sa.Column('params', JSONString(), nullable=True), sa.Column('networks', JSONString(), nullable=True), sa.Column('_ca_cert_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['_ca_cert_id'], [u'certificates.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('name', name=op.f('rabbitmq_brokers_pkey'))) op.add_column('deployment_updates', sa.Column('central_plugins_to_install', sa.PickleType())) op.add_column('deployment_updates', sa.Column('central_plugins_to_uninstall', sa.PickleType())) op.add_column( 'blueprints', sa.Column('is_hidden', sa.Boolean(), nullable=False, server_default='f')) _create_sites_table() _create_plugins_update_table()
# revision identifiers, used by Alembic. revision = '387fcd049efb' down_revision = '62a8d746d13b' branch_labels = None depends_on = None VISIBILITY_ENUM = postgresql.ENUM(VisibilityState.PRIVATE, VisibilityState.TENANT, VisibilityState.GLOBAL, name='visibility_states', create_type=False) config_table = table( 'config', column('name', sa.Text), column('value', JSONString()), column('schema', JSONString()), column('is_editable', sa.Boolean), column('updated_at', UTCDateTime()), column('scope', sa.Text), ) def upgrade(): _create_usage_collector_table() _create_inter_deployment_dependencies_table() _create_unique_indexes() _add_plugins_title_column() _remove_node_id_columns() _add_monitoring_credentials_columns()
def _create_filters_tables(): op.create_table( 'blueprints_filters', sa.Column('_storage_id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('id', sa.Text(), nullable=True), sa.Column('visibility', VISIBILITY_ENUM, nullable=True), sa.Column('created_at', UTCDateTime(), nullable=False), sa.Column('value', JSONString(), nullable=True), sa.Column('updated_at', UTCDateTime(), nullable=True), sa.Column('_tenant_id', sa.Integer(), nullable=False), sa.Column('_creator_id', sa.Integer(), nullable=False), sa.Column('is_system_filter', sa.Boolean(), nullable=False, server_default='f'), sa.ForeignKeyConstraint( ['_creator_id'], ['users.id'], name=op.f('blueprints_filters__creator_id_fkey'), ondelete='CASCADE'), sa.ForeignKeyConstraint( ['_tenant_id'], ['tenants.id'], name=op.f('blueprints_filters__tenant_id_fkey'), ondelete='CASCADE'), sa.PrimaryKeyConstraint('_storage_id', name=op.f('blueprints_filters_pkey'))) op.create_index(op.f('blueprints_filters__creator_id_idx'), 'blueprints_filters', ['_creator_id'], unique=False) op.create_index(op.f('blueprints_filters__tenant_id_idx'), 'blueprints_filters', ['_tenant_id'], unique=False) op.create_index(op.f('blueprints_filters_created_at_idx'), 'blueprints_filters', ['created_at'], unique=False) op.create_index('blueprints_filters_id__tenant_id_idx', 'blueprints_filters', ['id', '_tenant_id'], unique=True) op.create_index(op.f('blueprints_filters_id_idx'), 'blueprints_filters', ['id'], unique=False) op.create_index(op.f('blueprints_filters_visibility_idx'), 'blueprints_filters', ['visibility'], unique=False) op.create_index(op.f('blueprints_filters_is_system_filter_idx'), 'blueprints_filters', ['is_system_filter'], unique=False) op.create_table( 'deployments_filters', sa.Column('_storage_id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('id', sa.Text(), nullable=True), sa.Column('visibility', VISIBILITY_ENUM, nullable=True), sa.Column('created_at', UTCDateTime(), nullable=False), sa.Column('value', JSONString(), nullable=True), sa.Column('updated_at', UTCDateTime(), nullable=True), sa.Column('_tenant_id', sa.Integer(), nullable=False), sa.Column('_creator_id', sa.Integer(), nullable=False), sa.Column('is_system_filter', sa.Boolean(), nullable=False, server_default='f'), sa.ForeignKeyConstraint( ['_creator_id'], ['users.id'], name=op.f('deployments_filters__creator_id_fkey'), ondelete='CASCADE'), sa.ForeignKeyConstraint( ['_tenant_id'], ['tenants.id'], name=op.f('deployments_filters__tenant_id_fkey'), ondelete='CASCADE'), sa.PrimaryKeyConstraint('_storage_id', name=op.f('deployments_filters_pkey'))) op.create_index(op.f('deployments_filters__creator_id_idx'), 'deployments_filters', ['_creator_id'], unique=False) op.create_index(op.f('deployments_filters__tenant_id_idx'), 'deployments_filters', ['_tenant_id'], unique=False) op.create_index(op.f('deployments_filters_created_at_idx'), 'deployments_filters', ['created_at'], unique=False) op.create_index('deployments_filters_id__tenant_id_idx', 'deployments_filters', ['id', '_tenant_id'], unique=True) op.create_index(op.f('deployments_filters_id_idx'), 'deployments_filters', ['id'], unique=False) op.create_index(op.f('deployments_filters_visibility_idx'), 'deployments_filters', ['visibility'], unique=False) op.create_index(op.f('deployments_filters_is_system_filter_idx'), 'deployments_filters', ['is_system_filter'], unique=False) op.drop_index('filters__creator_id_idx', table_name='filters') op.drop_index('filters__tenant_id_idx', table_name='filters') op.drop_index('filters_created_at_idx', table_name='filters') op.drop_index('filters_id__tenant_id_idx', table_name='filters') op.drop_index('filters_id_idx', table_name='filters') op.drop_index('filters_visibility_idx', table_name='filters') op.drop_table('filters')
def upgrade(): # server_default accepts string or SQL element only op.add_column( 'executions', sa.Column('is_dry_run', sa.Boolean(), nullable=False, server_default='f')) op.add_column('executions', sa.Column('scheduled_for', UTCDateTime(), nullable=True)) op.execute('COMMIT') # Add new execution status op.execute("alter type execution_status add value 'scheduled'") op.add_column( 'deployments', sa.Column('capabilities', sa.PickleType(comparator=lambda *a: False))) op.add_column('events', sa.Column('source_id', sa.Text(), nullable=True)) op.add_column('events', sa.Column('target_id', sa.Text(), nullable=True)) op.add_column('logs', sa.Column('source_id', sa.Text(), nullable=True)) op.add_column('logs', sa.Column('target_id', sa.Text(), nullable=True)) # Create the agents table visibility_enum = postgresql.ENUM(*VisibilityState.STATES, name='visibility_states', create_type=False) agent_states_enum = postgresql.ENUM(*AgentState.STATES, name='agent_states') op.create_table( 'agents', sa.Column('_storage_id', sa.Integer(), nullable=False), sa.Column('id', sa.Text(), nullable=True), sa.Column('name', sa.Text(), nullable=False), sa.Column('ip', sa.Text(), nullable=True), sa.Column('install_method', sa.Text(), nullable=False), sa.Column('system', sa.Text(), nullable=True), sa.Column('version', sa.Text(), nullable=False), sa.Column('state', agent_states_enum, nullable=False), sa.Column('visibility', visibility_enum, nullable=True), sa.Column('rabbitmq_username', sa.Text(), nullable=True), sa.Column('rabbitmq_password', sa.Text(), nullable=True), sa.Column('rabbitmq_exchange', sa.Text(), nullable=False), sa.Column('created_at', UTCDateTime(), nullable=False), sa.Column('updated_at', UTCDateTime(), nullable=True), sa.Column('_node_instance_fk', sa.Integer(), nullable=False), sa.Column('_tenant_id', sa.Integer(), nullable=False), sa.Column('_creator_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['_creator_id'], [u'users.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['_node_instance_fk'], [u'node_instances._storage_id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['_tenant_id'], [u'tenants.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('_storage_id')) op.create_index(op.f('agents__tenant_id_idx'), 'agents', ['_tenant_id'], unique=False) op.create_index(op.f('agents_created_at_idx'), 'agents', ['created_at'], unique=False) op.create_index(op.f('agents_id_idx'), 'agents', ['id'], unique=False) # Remove the deprecated column private_resource from all the # resources tables for table_name in resource_tables: op.drop_column(table_name, 'private_resource') op.create_table( 'tasks_graphs', sa.Column('_storage_id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('id', sa.Text(), nullable=True), sa.Column('visibility', visibility_enum, nullable=True), sa.Column('name', sa.Text(), nullable=True), sa.Column('created_at', UTCDateTime(), nullable=False), sa.Column('_execution_fk', sa.Integer(), nullable=False), sa.Column('_tenant_id', sa.Integer(), nullable=False), sa.Column('_creator_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['_creator_id'], [u'users.id'], name=op.f('tasks_graphs__creator_id_fkey'), ondelete='CASCADE'), sa.ForeignKeyConstraint(['_execution_fk'], [u'executions._storage_id'], name=op.f('tasks_graphs__execution_fk_fkey'), ondelete='CASCADE'), sa.ForeignKeyConstraint(['_tenant_id'], [u'tenants.id'], name=op.f('tasks_graphs__tenant_id_fkey'), ondelete='CASCADE'), sa.PrimaryKeyConstraint('_storage_id', name=op.f('tasks_graphs_pkey'))) op.create_index(op.f('tasks_graphs__tenant_id_idx'), 'tasks_graphs', ['_tenant_id'], unique=False) op.create_index(op.f('tasks_graphs_created_at_idx'), 'tasks_graphs', ['created_at'], unique=False) op.create_index(op.f('tasks_graphs_id_idx'), 'tasks_graphs', ['id'], unique=False) op.create_table( 'operations', sa.Column('_storage_id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('id', sa.Text(), nullable=True), sa.Column('visibility', visibility_enum, nullable=True), sa.Column('name', sa.Text(), nullable=True), sa.Column('state', sa.Text(), nullable=False), sa.Column('created_at', UTCDateTime(), nullable=False), sa.Column('dependencies', postgresql.ARRAY(sa.Text()), nullable=True), sa.Column('type', sa.Text(), nullable=True), sa.Column('parameters', JSONString(), nullable=True), sa.Column('_tasks_graph_fk', sa.Integer(), nullable=False), sa.Column('_tenant_id', sa.Integer(), nullable=False), sa.Column('_creator_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['_creator_id'], [u'users.id'], name=op.f('operations__creator_id_fkey'), ondelete='CASCADE'), sa.ForeignKeyConstraint(['_tasks_graph_fk'], [u'tasks_graphs._storage_id'], name=op.f('operations__tasks_graph_fk_fkey'), ondelete='CASCADE'), sa.ForeignKeyConstraint(['_tenant_id'], [u'tenants.id'], name=op.f('operations__tenant_id_fkey'), ondelete='CASCADE'), sa.PrimaryKeyConstraint('_storage_id', name=op.f('operations_pkey'))) op.create_index(op.f('operations__tenant_id_idx'), 'operations', ['_tenant_id'], unique=False) op.create_index(op.f('operations_created_at_idx'), 'operations', ['created_at'], unique=False) op.create_index(op.f('operations_id_idx'), 'operations', ['id'], unique=False)
def create_execution_schedules_table(): op.create_table( 'execution_schedules', sa.Column('_storage_id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('id', sa.Text(), nullable=True), sa.Column('visibility', VISIBILITY_ENUM, nullable=True), sa.Column('created_at', UTCDateTime(), nullable=False), sa.Column('next_occurrence', UTCDateTime(), nullable=True), sa.Column('since', UTCDateTime(), nullable=True), sa.Column('until', UTCDateTime(), nullable=True), sa.Column('rule', JSONString(), nullable=False), sa.Column('slip', sa.Integer(), nullable=False), sa.Column('workflow_id', sa.Text(), nullable=False), sa.Column('parameters', JSONString(), nullable=True), sa.Column('execution_arguments', JSONString(), nullable=True), sa.Column('stop_on_fail', sa.Boolean(), nullable=False, server_default='f'), sa.Column('enabled', sa.Boolean(), nullable=False, server_default='t'), sa.Column('_deployment_fk', sa.Integer(), nullable=False), sa.Column('_latest_execution_fk', sa.Integer(), nullable=True), sa.Column('_tenant_id', sa.Integer(), nullable=False), sa.Column('_creator_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint( ['_creator_id'], [u'users.id'], name=op.f('execution_schedules__creator_id_fkey'), ondelete='CASCADE'), sa.ForeignKeyConstraint( ['_tenant_id'], [u'tenants.id'], name=op.f('execution_schedules__tenant_id_fkey'), ondelete='CASCADE'), sa.ForeignKeyConstraint( ['_deployment_fk'], [u'deployments._storage_id'], name=op.f('execution_schedules__deployment_fkey'), ondelete='CASCADE'), sa.PrimaryKeyConstraint('_storage_id', name=op.f('execution_schedules_pkey')), ) op.create_foreign_key( op.f('execution_schedules__latest_execution_fk_fkey'), 'execution_schedules', 'executions', ['_latest_execution_fk'], ['_storage_id'], ondelete='CASCADE') op.create_index(op.f('execution_schedules_created_at_idx'), 'execution_schedules', ['created_at'], unique=False) op.create_index(op.f('execution_schedules_id_idx'), 'execution_schedules', ['id'], unique=False) op.create_index(op.f('execution_schedules__creator_id_idx'), 'execution_schedules', ['_creator_id'], unique=False) op.create_index(op.f('execution_schedules__tenant_id_idx'), 'execution_schedules', ['_tenant_id'], unique=False) op.create_index(op.f('execution_schedules_visibility_idx'), 'execution_schedules', ['visibility'], unique=False) op.create_index(op.f('execution_schedules_next_occurrence_idx'), 'execution_schedules', ['next_occurrence'], unique=False) op.create_index(op.f('execution_schedules__deployment_fk_idx'), 'execution_schedules', ['_deployment_fk'], unique=False) op.create_index(op.f('execution_schedules__latest_execution_fk_idx'), 'execution_schedules', ['_latest_execution_fk'], unique=False)
def create_deployment_groups_table(): op.create_table( 'deployment_groups', sa.Column('_storage_id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('id', sa.Text(), nullable=True), sa.Column('visibility', postgresql.ENUM('private', 'tenant', 'global', name='visibility_states', create_type=False), nullable=True), sa.Column('created_at', UTCDateTime(), nullable=False), sa.Column('description', sa.Text(), nullable=True), sa.Column('_default_blueprint_fk', sa.Integer(), nullable=True), sa.Column('default_inputs', JSONString(), nullable=True), sa.Column('_tenant_id', sa.Integer(), nullable=False), sa.Column('_creator_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint( ['_default_blueprint_fk'], ['blueprints._storage_id'], name=op.f('deployment_groups__default_blueprint_fk_fkey'), ondelete='SET NULL'), sa.ForeignKeyConstraint( ['_creator_id'], ['users.id'], name=op.f('deployment_groups__creator_id_fkey'), ondelete='CASCADE'), sa.ForeignKeyConstraint(['_tenant_id'], ['tenants.id'], name=op.f('deployment_groups__tenant_id_fkey'), ondelete='CASCADE'), sa.PrimaryKeyConstraint('_storage_id', name=op.f('deployment_groups_pkey'))) op.create_index(op.f('deployment_groups__default_blueprint_fk_idx'), 'deployment_groups', ['_default_blueprint_fk'], unique=False) op.create_index(op.f('deployment_groups__creator_id_idx'), 'deployment_groups', ['_creator_id'], unique=False) op.create_index(op.f('deployment_groups__tenant_id_idx'), 'deployment_groups', ['_tenant_id'], unique=False) op.create_index(op.f('deployment_groups_created_at_idx'), 'deployment_groups', ['created_at'], unique=False) op.create_index(op.f('deployment_groups_id_idx'), 'deployment_groups', ['id'], unique=False) op.create_index(op.f('deployment_groups_visibility_idx'), 'deployment_groups', ['visibility'], unique=False) op.create_table( 'deployment_groups_deployments', sa.Column('deployment_group_id', sa.Integer(), nullable=True), sa.Column('deployment_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint( ['deployment_group_id'], ['deployment_groups._storage_id'], name=op.f( 'deployment_groups_deployments_deployment_grou_id_fkey')), sa.ForeignKeyConstraint( ['deployment_id'], ['deployments._storage_id'], name=op.f('deployment_groups_deployments_deployment_id_fkey')))