def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_table('global_parameters') op.alter_column('network_groups', 'netmask', existing_type=sa.VARCHAR(length=25), nullable=True) op.drop_table('plugins') op.drop_table('allowed_networks') op.add_column('network_groups', sa.Column('meta', JSON(), nullable=True)) op.add_column('node_nic_interfaces', sa.Column('parent_id', sa.Integer(), nullable=True)) op.rename_table('net_assignments', 'net_nic_assignments') op.create_table( 'node_bond_interfaces', sa.Column('id', sa.Integer(), nullable=False), sa.Column('node_id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=32), nullable=False), sa.Column('mac', LowercaseString(length=17), nullable=True), sa.Column('state', sa.String(length=25), nullable=True), sa.Column('flags', JSON(), nullable=True), sa.Column('mode', sa.Enum('active-backup', 'balance-slb', 'lacp-balance-tcp', name='bond_mode'), nullable=False), sa.ForeignKeyConstraint(['node_id'], ['nodes.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id')) op.create_table( 'net_bond_assignments', sa.Column('id', sa.Integer(), nullable=False), sa.Column('network_id', sa.Integer(), nullable=False), sa.Column('bond_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['bond_id'], ['node_bond_interfaces.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['network_id'], ['network_groups.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id')) # CLUSTER STATUS ENUM UPGRADE upgrade_enum( "clusters", # table "status", # column "cluster_status", # ENUM name old_cluster_status_options, # old options new_cluster_status_options # new options ) # TASK NAME ENUM UPGRADE upgrade_enum( "tasks", # table "name", # column "task_name", # ENUM name old_task_names_options, # old options new_task_names_options # new options )
def upgrade(): connection = op.get_bind() op.create_table( table_volumes_name, sa.Column('id', sa.Integer(), nullable=False), sa.Column('node_id', sa.Integer(), nullable=False), sa.Column('volumes', JSON(), server_default='[]', nullable=False), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('node_id')) migrate_data_from_core(connection)
def upgrade(): op.create_table('red_hat_accounts', sa.Column('id', sa.Integer(), nullable=False), sa.Column( 'username', sa.String(length=100), nullable=False), sa.Column( 'password', sa.String(length=100), nullable=False), sa.Column('license_type', sa.Enum( 'rhsm', 'rhn', name='license_type'), nullable=False), sa.Column( 'satellite', sa.String(length=250), nullable=True), sa.Column( 'activation_key', sa.String(length=300), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_table('capacity_log', sa.Column('id', sa.Integer(), nullable=False), sa.Column('report', JSON(), nullable=True), sa.Column('datetime', sa.DateTime(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_table('releases', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.Unicode(length=100), nullable=False), sa.Column('version', sa.String(length=30), nullable=False), sa.Column('description', sa.Unicode(), nullable=True), sa.Column( 'operating_system', sa.String(length=50), nullable=False), sa.Column('state', sa.Enum('not_available', 'downloading', 'error', 'available', name='release_state'), nullable=False), sa.Column('networks_metadata', JSON(), nullable=True), sa.Column('attributes_metadata', JSON(), nullable=True), sa.Column('volumes_metadata', JSON(), nullable=True), sa.Column('modes_metadata', JSON(), nullable=True), sa.Column('roles_metadata', JSON(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name', 'version') ) op.create_table('clusters', sa.Column('id', sa.Integer(), nullable=False), sa.Column('mode', sa.Enum( 'multinode', 'ha_full', 'ha_compact', name='cluster_mode'), nullable=False), sa.Column('status', sa.Enum('new', 'deployment', 'stopped', 'operational', 'error', 'remove', name='cluster_status'), nullable=False), sa.Column('net_provider', sa.Enum( 'nova_network', 'neutron', name='net_provider'), nullable=False), sa.Column('grouping', sa.Enum( 'roles', 'hardware', 'both', name='cluster_grouping'), nullable=False), sa.Column('name', sa.Unicode(length=50), nullable=False), sa.Column('release_id', sa.Integer(), nullable=False), sa.Column( 'replaced_deployment_info', JSON(), nullable=True), sa.Column( 'replaced_provisioning_info', JSON(), nullable=True), sa.Column('is_customized', sa.Boolean(), nullable=True), sa.Column( 'fuel_version', sa.Text, nullable=False), sa.ForeignKeyConstraint(['release_id'], ['releases.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name') ) op.create_table('release_orchestrator_data', sa.Column('id', sa.Integer(), nullable=False), sa.Column('release_id', sa.Integer(), nullable=False), sa.Column('repo_metadata', JSON(), nullable=False), sa.Column( 'puppet_manifests_source', sa.Text(), nullable=False), sa.Column( 'puppet_modules_source', sa.Text(), nullable=False), sa.ForeignKeyConstraint(['release_id'], ['releases.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_table('roles', sa.Column('id', sa.Integer(), nullable=False), sa.Column('release_id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=50), nullable=False), sa.ForeignKeyConstraint( ['release_id'], ['releases.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name', 'release_id') ) op.create_table('nodes', sa.Column('id', sa.Integer(), nullable=False), sa.Column('uuid', sa.String(length=36), nullable=False), sa.Column('cluster_id', sa.Integer(), nullable=True), sa.Column('name', sa.Unicode(length=100), nullable=True), sa.Column('status', sa.Enum('ready', 'discover', 'provisioning', 'provisioned', 'deploying', 'error', name='node_status'), nullable=False), sa.Column('meta', JSON(), nullable=True), sa.Column('mac', LowercaseString(), nullable=False), sa.Column('ip', sa.String(length=15), nullable=True), sa.Column('fqdn', sa.String(length=255), nullable=True), sa.Column( 'manufacturer', sa.Unicode(length=50), nullable=True), sa.Column( 'platform_name', sa.String(length=150), nullable=True), sa.Column('kernel_params', sa.Text(), nullable=True), sa.Column('progress', sa.Integer(), nullable=True), sa.Column( 'os_platform', sa.String(length=150), nullable=True), sa.Column('pending_addition', sa.Boolean(), nullable=True), sa.Column('pending_deletion', sa.Boolean(), nullable=True), sa.Column('error_type', sa.Enum( 'deploy', 'provision', 'deletion', name='node_error_type'), nullable=True), sa.Column( 'error_msg', sa.String(length=255), nullable=True), sa.Column('timestamp', sa.DateTime(), nullable=False), sa.Column('online', sa.Boolean(), nullable=True), sa.Column( 'agent_checksum', sa.String(length=40), nullable=True), sa.ForeignKeyConstraint(['cluster_id'], ['clusters.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('mac'), sa.UniqueConstraint('uuid') ) op.create_table('tasks', sa.Column('id', sa.Integer(), nullable=False), sa.Column('cluster_id', sa.Integer(), nullable=True), sa.Column('uuid', sa.String(length=36), nullable=False), sa.Column('name', sa.Enum('super', 'deploy', 'deployment', 'provision', 'stop_deployment', 'reset_environment', 'node_deletion', 'cluster_deletion', 'check_before_deployment', 'check_networks', 'verify_networks', 'check_dhcp', 'verify_network_connectivity', 'redhat_setup', 'redhat_check_credentials', 'redhat_check_licenses', 'redhat_download_release', 'redhat_update_cobbler_profile', 'dump', 'capacity_log', name='task_name'), nullable=False), sa.Column('message', sa.Text(), nullable=True), sa.Column('status', sa.Enum( 'ready', 'running', 'error', name='task_status'), nullable=False), sa.Column('progress', sa.Integer(), nullable=True), sa.Column('cache', JSON(), nullable=True), sa.Column('result', JSON(), nullable=True), sa.Column('parent_id', sa.Integer(), nullable=True), sa.Column('weight', sa.Float(), nullable=True), sa.ForeignKeyConstraint(['cluster_id'], ['clusters.id'], ), sa.ForeignKeyConstraint(['parent_id'], ['tasks.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_table('networking_configs', sa.Column('id', sa.Integer(), nullable=False), sa.Column( 'discriminator', sa.String(length=50), nullable=True), sa.Column('cluster_id', sa.Integer(), nullable=True), sa.Column('dns_nameservers', JSON(), nullable=True), sa.Column('floating_ranges', JSON(), nullable=True), sa.ForeignKeyConstraint( ['cluster_id'], ['clusters.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id') ) op.create_table('network_groups', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.Enum('fuelweb_admin', 'storage', 'management', 'public', 'fixed', 'private', name='network_group_name'), nullable=False), sa.Column('release', sa.Integer(), nullable=True), sa.Column('cluster_id', sa.Integer(), nullable=True), sa.Column('vlan_start', sa.Integer(), nullable=True), sa.Column('cidr', sa.String(length=25), nullable=True), sa.Column('gateway', sa.String(length=25), nullable=True), sa.Column('meta', JSON(), nullable=True), sa.ForeignKeyConstraint(['cluster_id'], ['clusters.id'], ), sa.ForeignKeyConstraint(['release'], ['releases.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_table('attributes', sa.Column('id', sa.Integer(), nullable=False), sa.Column('cluster_id', sa.Integer(), nullable=True), sa.Column('editable', JSON(), nullable=True), sa.Column('generated', JSON(), nullable=True), sa.ForeignKeyConstraint(['cluster_id'], ['clusters.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_table('nova_network_config', sa.Column('id', sa.Integer(), nullable=False), sa.Column( 'fixed_networks_cidr', sa.String(length=25), nullable=True), sa.Column( 'fixed_networks_vlan_start', sa.Integer(), nullable=True), sa.Column( 'fixed_network_size', sa.Integer(), nullable=False), sa.Column( 'fixed_networks_amount', sa.Integer(), nullable=False), sa.Column('net_manager', sa.Enum( 'FlatDHCPManager', 'VlanManager', name='cluster_net_manager'), nullable=False), sa.ForeignKeyConstraint( ['id'], ['networking_configs.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_table('node_roles', sa.Column('id', sa.Integer(), nullable=False), sa.Column('role', sa.Integer(), nullable=True), sa.Column('node', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['node'], ['nodes.id'], ), sa.ForeignKeyConstraint( ['role'], ['roles.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id') ) op.create_table('cluster_changes', sa.Column('id', sa.Integer(), nullable=False), sa.Column('cluster_id', sa.Integer(), nullable=True), sa.Column('node_id', sa.Integer(), nullable=True), sa.Column('name', sa.Enum( 'networks', 'attributes', 'disks', name='possible_changes'), nullable=False), sa.ForeignKeyConstraint(['cluster_id'], ['clusters.id'], ), sa.ForeignKeyConstraint( ['node_id'], ['nodes.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id') ) op.create_table('node_attributes', sa.Column('id', sa.Integer(), nullable=False), sa.Column('node_id', sa.Integer(), nullable=True), sa.Column('volumes', JSON(), nullable=True), sa.Column('interfaces', JSON(), nullable=True), sa.ForeignKeyConstraint(['node_id'], ['nodes.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_table('notifications', sa.Column('id', sa.Integer(), nullable=False), sa.Column('cluster_id', sa.Integer(), nullable=True), sa.Column('node_id', sa.Integer(), nullable=True), sa.Column('task_id', sa.Integer(), nullable=True), sa.Column('topic', sa.Enum( 'discover', 'done', 'error', 'warning', name='notif_topic'), nullable=False), sa.Column('message', sa.Text(), nullable=True), sa.Column( 'status', sa.Enum('read', 'unread', name='notif_status'), nullable=False), sa.Column('datetime', sa.DateTime(), nullable=False), sa.ForeignKeyConstraint( ['cluster_id'], ['clusters.id'], ondelete='SET NULL'), sa.ForeignKeyConstraint( ['node_id'], ['nodes.id'], ondelete='SET NULL'), sa.ForeignKeyConstraint( ['task_id'], ['tasks.id'], ondelete='SET NULL'), sa.PrimaryKeyConstraint('id') ) op.create_table('node_bond_interfaces', sa.Column('id', sa.Integer(), nullable=False), sa.Column('node_id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=32), nullable=False), sa.Column('mac', LowercaseString(), nullable=True), sa.Column('state', sa.String(length=25), nullable=True), sa.Column('flags', JSON(), nullable=True), sa.Column('mode', sa.Enum('active-backup', 'balance-slb', 'lacp-balance-tcp', name='bond_mode'), nullable=False), sa.ForeignKeyConstraint( ['node_id'], ['nodes.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id') ) op.create_table('ip_addrs', sa.Column('id', sa.Integer(), nullable=False), sa.Column('network', sa.Integer(), nullable=True), sa.Column('node', sa.Integer(), nullable=True), sa.Column('ip_addr', sa.String(length=25), nullable=False), sa.ForeignKeyConstraint( ['network'], ['network_groups.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint( ['node'], ['nodes.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id') ) op.create_table('ip_addr_ranges', sa.Column('id', sa.Integer(), nullable=False), sa.Column('network_group_id', sa.Integer(), nullable=True), sa.Column('first', sa.String(length=25), nullable=False), sa.Column('last', sa.String(length=25), nullable=False), sa.ForeignKeyConstraint( ['network_group_id'], ['network_groups.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_table('neutron_config', sa.Column('id', sa.Integer(), nullable=False), sa.Column('vlan_range', JSON(), nullable=True), sa.Column('gre_id_range', JSON(), nullable=True), sa.Column( 'base_mac', LowercaseString(), nullable=False), sa.Column( 'internal_cidr', sa.String(length=25), nullable=True), sa.Column( 'internal_gateway', sa.String(length=25), nullable=True), sa.Column('segmentation_type', sa.Enum( 'vlan', 'gre', name='segmentation_type'), nullable=False), sa.Column('net_l23_provider', sa.Enum( 'ovs', name='net_l23_provider'), nullable=False), sa.ForeignKeyConstraint( ['id'], ['networking_configs.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_table('pending_node_roles', sa.Column('id', sa.Integer(), nullable=False), sa.Column('role', sa.Integer(), nullable=True), sa.Column('node', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['node'], ['nodes.id'], ), sa.ForeignKeyConstraint( ['role'], ['roles.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id') ) op.create_table('node_nic_interfaces', sa.Column('id', sa.Integer(), nullable=False), sa.Column('node_id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=128), nullable=False), sa.Column('mac', LowercaseString(), nullable=False), sa.Column('max_speed', sa.Integer(), nullable=True), sa.Column('current_speed', sa.Integer(), nullable=True), sa.Column('ip_addr', sa.String(length=25), nullable=True), sa.Column('netmask', sa.String(length=25), nullable=True), sa.Column('state', sa.String(length=25), nullable=True), sa.Column('parent_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint( ['node_id'], ['nodes.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint( ['parent_id'], ['node_bond_interfaces.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_table('net_bond_assignments', sa.Column('id', sa.Integer(), nullable=False), sa.Column('network_id', sa.Integer(), nullable=False), sa.Column('bond_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint( ['bond_id'], ['node_bond_interfaces.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint( ['network_id'], ['network_groups.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id') ) op.create_table('net_nic_assignments', sa.Column('id', sa.Integer(), nullable=False), sa.Column('network_id', sa.Integer(), nullable=False), sa.Column('interface_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint( ['interface_id'], ['node_nic_interfaces.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint( ['network_id'], ['network_groups.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id') )
def upgrade_schema(): # commands auto generated by Alembic - please adjust! ### op.add_column( 'releases', sa.Column('can_update_from_versions', JSON(), nullable=False, server_default='[]')) op.add_column('releases', sa.Column('wizard_metadata', JSON(), nullable=True)) op.add_column('clusters', sa.Column('pending_release_id', sa.Integer(), nullable=True)) op.create_foreign_key( 'fk_pending_release_id', 'clusters', 'releases', ['pending_release_id'], ['id'], ) upgrade_enum( "clusters", # table "status", # column "cluster_status", # ENUM name cluster_statuses_old, # old options cluster_statuses_new # new options ) upgrade_enum( "tasks", # table "name", # column "task_name", # ENUM name task_names_old, # old options task_names_new # new options ) upgrade_enum( "notifications", # table "topic", # column "notif_topic", # ENUM name notification_topics_old, # old options notification_topics_new, # new options ) upgrade_enum( "cluster_changes", # table "name", # column "possible_changes", # ENUM name cluster_changes_old, # old options cluster_changes_new # new options ) upgrade_enum( "neutron_config", # table "net_l23_provider", # column "net_l23_provider", # ENUM name neutron_l23_providers_old, # old options neutron_l23_providers_new # new options ) op.drop_table('red_hat_accounts') drop_enum('license_type') op.add_column('nodes', sa.Column('replaced_deployment_info', JSON(), nullable=True)) op.add_column( 'nodes', sa.Column('replaced_provisioning_info', JSON(), nullable=True))
class DeploymentGraphTask(Base): __tablename__ = 'deployment_graph_tasks' __table_args__ = ( sa.UniqueConstraint( 'deployment_graph_id', 'task_name', name='_task_name_deployment_graph_id_uc'), ) id = sa.Column( sa.Integer, primary_key=True) deployment_graph_id = sa.Column( sa.Integer, sa.ForeignKey('deployment_graphs.id', ondelete='CASCADE'), nullable=False) deployment_graph = sa.orm.relationship( 'DeploymentGraph', backref=sa.orm.backref("tasks", cascade="all, delete-orphan")) # not task_id because it could be perceived as fk # and not id because it is not unique inside table task_name = sa.Column( sa.String(255), index=True, nullable=False) version = sa.Column( sa.String(255), nullable=False, server_default='1.0.0', default='1.0.0') # this field may contain string or dict condition = sa.Column( JSON(), nullable=True) type = sa.Column( sa.Enum( *consts.ORCHESTRATOR_TASK_TYPES, name='deployment_graph_tasks_type'), nullable=False) groups = sa.Column( sa.dialects.postgresql.ARRAY(sa.String(255)), default=[], server_default='{}', nullable=False) tasks = sa.Column( sa.dialects.postgresql.ARRAY(sa.String(255)), default=[], server_default='{}', nullable=False) roles = sa.Column( # node roles sa.dialects.postgresql.ARRAY(sa.String(255)), default=[], server_default='{}', nullable=False) # list of Nailgun events on which this task should be re-executed reexecute_on = sa.Column( sa.dialects.postgresql.ARRAY(sa.String(255)), default=[], server_default='{}', nullable=False) refresh_on = sa.Column( # new in 8.0 sa.dialects.postgresql.ARRAY(sa.String(255)), default=[], server_default='{}', nullable=False) required_for = sa.Column( sa.dialects.postgresql.ARRAY(sa.String(255)), default=[], server_default='{}', nullable=False) requires = sa.Column( sa.dialects.postgresql.ARRAY(sa.String(255)), default=[], server_default='{}', nullable=False) # cross-depended-by with hypen is deprecated notation cross_depended_by = sa.Column( MutableList.as_mutable(JSON), default=[], server_default='[]') # cross-depends with hypen is deprecated notation cross_depends = sa.Column( MutableList.as_mutable(JSON), default=[], server_default='[]') parameters = sa.Column( MutableDict.as_mutable(JSON), default={}, server_default='{}') # custom field for all fields that does not fit into the schema _custom = sa.Column( MutableDict.as_mutable(JSON), default={}, server_default='{}')
def upgrade_schema(): op.add_column( 'releases', sa.Column( 'is_deployable', sa.Boolean(), nullable=False, server_default='true', )) op.create_table( 'action_logs', sa.Column('id', sa.Integer, nullable=False), sa.Column('actor_id', sa.String(length=64), nullable=True), sa.Column('action_group', sa.String(length=64), nullable=False), sa.Column('action_name', sa.String(length=64), nullable=False), sa.Column('action_type', sa.Enum('http_request', 'nailgun_task', name='action_type'), nullable=False), sa.Column('start_timestamp', sa.DateTime, nullable=False), sa.Column('end_timestamp', sa.DateTime, nullable=True), sa.Column('is_sent', sa.Boolean, default=False), sa.Column('additional_info', JSON(), nullable=False), sa.Column('cluster_id', sa.Integer, nullable=True), sa.Column('task_uuid', sa.String(36), nullable=True), sa.PrimaryKeyConstraint('id')) op.create_table( 'master_node_settings', sa.Column('id', sa.Integer, nullable=False), sa.Column('master_node_uid', sa.String(36), nullable=False), sa.Column('settings', JSON(), default={}), sa.PrimaryKeyConstraint('id')) op.create_table( 'plugins', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=100), nullable=False), sa.Column('title', sa.String(length=100), nullable=False), sa.Column('version', sa.String(length=32), nullable=False), sa.Column('description', sa.String(length=400), nullable=True), sa.Column('releases', JSON(), nullable=True), sa.Column('fuel_version', JSON(), nullable=True), sa.Column('package_version', sa.String(length=32), nullable=False), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name', 'version', name='_name_version_unique')) op.create_table( 'cluster_plugins', sa.Column('id', sa.Integer(), nullable=False), sa.Column('plugin_id', sa.Integer(), nullable=False), sa.Column('cluster_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint( ['cluster_id'], ['clusters.id'], ), sa.ForeignKeyConstraint(['plugin_id'], ['plugins.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id')) op.create_table('nodegroups', sa.Column('id', sa.Integer(), nullable=False), sa.Column('cluster_id', sa.Integer(), nullable=True), sa.Column('name', sa.String(length=50), nullable=False), sa.ForeignKeyConstraint(['cluster_id'], ['clusters.id']), sa.PrimaryKeyConstraint('id')) op.create_unique_constraint(None, 'clusters', ['name']) op.add_column('network_groups', sa.Column('group_id', sa.Integer(), nullable=True)) op.add_column('nodes', sa.Column('group_id', sa.Integer(), nullable=True)) # We need this code here because the "upgrade_node_groups" function # relies on "cluster_id" column from "network_groups" table. connection = op.get_bind() upgrade_node_groups(connection) op.drop_column('network_groups', 'cluster_id') op.add_column( 'node_roles', sa.Column('primary', sa.Boolean(), nullable=False, server_default='false')) op.add_column( 'pending_node_roles', sa.Column('primary', sa.Boolean(), nullable=False, server_default='false'))