本文整理汇总了Python中trove.db.sqlalchemy.migrate_repo.schema.Table.drop_column方法的典型用法代码示例。如果您正苦于以下问题:Python Table.drop_column方法的具体用法?Python Table.drop_column怎么用?Python Table.drop_column使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trove.db.sqlalchemy.migrate_repo.schema.Table
的用法示例。
在下文中一共展示了Table.drop_column方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: downgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import drop_column [as 别名]
def downgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
# drop column:
backups = Table('backups', meta, autoload=True)
backups.drop_column('parent_id')
示例2: downgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import drop_column [as 别名]
def downgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
modules = Table('modules', meta, autoload=True)
modules.drop_column(COLUMN_NAME_1)
modules.drop_column(COLUMN_NAME_2)
modules.drop_column(COLUMN_NAME_3)
示例3: downgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import drop_column [as 别名]
def downgrade(migrate_engine):
meta.bind = migrate_engine
drop_tables([datastores, datastore_versions])
instances = Table('instances', meta, autoload=True)
instances.drop_column('datastore_version_id')
service_type = Column('service_type', String(36))
instances.create_column(service_type)
instances.update().values({'service_type': 'mysql'}).execute()
示例4: upgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import drop_column [as 别名]
def upgrade(migrate_engine):
meta.bind = migrate_engine
create_tables([datastores, datastore_versions])
instances = Table('instances', meta, autoload=True)
datastore_version_id = Column('datastore_version_id', String(36),
ForeignKey('datastore_versions.id'))
instances.create_column(datastore_version_id)
instances.drop_column('service_type')
示例5: downgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import drop_column [as 别名]
def downgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
# drop column:
instances = Table('instances', meta, autoload=True)
instances.drop_column('deleted')
instances.drop_column('deleted_at')
示例6: downgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import drop_column [as 别名]
def downgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
# drop column:
backups = Table('backups', meta, autoload=True)
migrate_engine.execute('DROP INDEX backups_parent_id_idx ON backups')
migrate_engine.execute('DROP INDEX backups_deleted_idx ON backups')
backups.drop_column('parent_id')
示例7: downgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import drop_column [as 别名]
def downgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
instances = Table("instances", meta, autoload=True)
constraint_names = db_utils.get_foreign_key_constraint_names(
engine=migrate_engine, table="instances", columns=[COLUMN_NAME], ref_table="instances", ref_columns=["id"]
)
db_utils.drop_foreign_key_constraints(
constraint_names=constraint_names, columns=[instances.c.slave_of_id], ref_columns=[instances.c.id]
)
instances.drop_column(COLUMN_NAME)
示例8: downgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import drop_column [as 别名]
def downgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
datastores = Table('datastores', meta, autoload=True)
datastore_versions = Table('datastore_versions', meta, autoload=True)
# drop column from datastore_versions
datastore_versions.drop_column('manager')
# add column to datastores
manager = Column('manager', String(255))
datastores.create_column(manager)
示例9: downgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import drop_column [as 别名]
def downgrade(migrate_engine):
meta.bind = migrate_engine
# modify column:
backups = Table('backups', meta, autoload=True)
backups.drop_column("group_id")
backups.drop_column("type")
backups.drop_column("expire_at")
backups.drop_column("service_image_id")
instances = Table('instances', meta, autoload=True)
instances.drop_column('group_id')
drop_tables([InstanceGroup,InstanceGroupItem,InstanceVip,Vips,Autobackup,
security_group_group_associations])
示例10: downgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import drop_column [as 别名]
def downgrade(migrate_engine):
meta.bind = migrate_engine
instances = Table('instances', meta, autoload=True)
constraint_names = db_utils.get_foreign_key_constraint_names(
engine=migrate_engine,
table='instances',
columns=['configuration_id'],
ref_table='configurations',
ref_columns=['id'])
db_utils.drop_foreign_key_constraints(
constraint_names=constraint_names,
columns=[instances.c.configuration_id],
ref_columns=[configurations.c.id])
instances.drop_column('configuration_id')
drop_tables([configuration_parameters, configurations])
示例11: downgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import drop_column [as 别名]
def downgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
backups = Table('backups', meta, autoload=True)
datastore_versions = Table('datastore_versions', meta, autoload=True)
constraint_names = db_utils.get_foreign_key_constraint_names(
engine=migrate_engine,
table='backups',
columns=['datastore_version_id'],
ref_table='datastore_versions',
ref_columns=['id'])
db_utils.drop_foreign_key_constraints(
constraint_names=constraint_names,
columns=[backups.c.datastore_version_id],
ref_columns=[datastore_versions.c.id])
backups.drop_column('datastore_version_id')
示例12: downgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import drop_column [as 别名]
def downgrade(migrate_engine):
meta.bind = migrate_engine
instances = Table('instances', meta, autoload=True)
constraint_names = db_utils.get_foreign_key_constraint_names(
engine=migrate_engine,
table='instances',
columns=['datastore_version_id'],
ref_table='datastore_versions',
ref_columns=['id'])
db_utils.drop_foreign_key_constraints(
constraint_names=constraint_names,
columns=[instances.c.datastore_version_id],
ref_columns=[datastore_versions.c.id])
instances.drop_column('datastore_version_id')
service_type = Column('service_type', String(36))
instances.create_column(service_type)
instances.update().values({'service_type': 'mysql'}).execute()
drop_tables([datastore_versions, datastores])
示例13: downgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import drop_column [as 别名]
def downgrade(migrate_engine):
meta.bind = migrate_engine
clusters = Table('clusters', meta, autoload=True)
configurations = Table('configurations', meta, autoload=True,
autoload_with=migrate_engine)
constraint_names = db_utils.get_foreign_key_constraint_names(
engine=migrate_engine,
table='clusters',
columns=['configuration_id'],
ref_table='configurations',
ref_columns=['id'])
db_utils.drop_foreign_key_constraints(
constraint_names=constraint_names,
columns=[clusters.c.configuration_id],
ref_columns=[configurations.c.id])
clusters.drop_column('configuration_id')
示例14: downgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import drop_column [as 别名]
def downgrade(migrate_engine):
meta.bind = migrate_engine
datastore_versions = Table('datastore_versions', meta, autoload=True)
constraint_names = db_utils.get_foreign_key_constraint_names(
engine=migrate_engine,
table='clusters',
columns=['datastore_version_id'],
ref_table='datastore_versions',
ref_columns=['id'])
db_utils.drop_foreign_key_constraints(
constraint_names=constraint_names,
columns=[clusters.c.datastore_version_id],
ref_columns=[datastore_versions.c.id])
instances = Table('instances', meta, autoload=True)
constraint_names = db_utils.get_foreign_key_constraint_names(
engine=migrate_engine,
table='instances',
columns=['cluster_id'],
ref_table='clusters',
ref_columns=['id'])
db_utils.drop_foreign_key_constraints(
constraint_names=constraint_names,
columns=[instances.c.cluster_id],
ref_columns=[clusters.c.id])
instances.drop_column('cluster_id')
instances.drop_column('shard_id')
instances.drop_column('type')
drop_tables([clusters])
示例15: downgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import drop_column [as 别名]
def downgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
# modify column:
instances = Table('instances', meta, autoload=True)
instances.drop_column('service_type')