本文整理汇总了Python中trove.db.sqlalchemy.migrate_repo.schema.Table.create_column方法的典型用法代码示例。如果您正苦于以下问题:Python Table.create_column方法的具体用法?Python Table.create_column怎么用?Python Table.create_column使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trove.db.sqlalchemy.migrate_repo.schema.Table
的用法示例。
在下文中一共展示了Table.create_column方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: upgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import create_column [as 别名]
def upgrade(migrate_engine):
meta.bind = migrate_engine
create_tables([configurations])
create_tables([configuration_parameters])
instances = Table('instances', meta, autoload=True)
instances.create_column(Column('configuration_id', String(36),
ForeignKey("configurations.id")))
示例2: upgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import create_column [as 别名]
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
instances = Table('instances', meta, autoload=True)
instances.create_column(
Column(COLUMN_NAME, String(36), ForeignKey('instances.id')),
nullable=True)
示例3: upgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import create_column [as 别名]
def upgrade(migrate_engine):
meta.bind = migrate_engine
# Load 'configurations' table to MetaData.
Table('configurations', meta, autoload=True, autoload_with=migrate_engine)
instances = Table('clusters', meta, autoload=True)
instances.create_column(Column('configuration_id', String(36),
ForeignKey("configurations.id")))
示例4: upgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import create_column [as 别名]
def upgrade(migrate_engine):
meta = MetaData(bind=migrate_engine)
configurations = Table('configurations', meta, autoload=True)
created = Column('created', DateTime())
updated = Column('updated', DateTime())
configurations.create_column(created)
configurations.create_column(updated)
示例5: upgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import create_column [as 别名]
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
instances = Table('instances', meta, autoload=True)
service_type = Column('service_type', String(36))
instances.create_column(service_type)
instances.update().values({'service_type': 'mysql'}).execute()
示例6: upgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import create_column [as 别名]
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
# add column:
backups = Table('backups', meta, autoload=True)
backups.create_column(Column('parent_id', String(36), nullable=True))
示例7: upgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import create_column [as 别名]
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
backups = Table('backups', meta, autoload=True)
Table('datastore_versions', meta, autoload=True)
datastore_version_id = Column('datastore_version_id', String(36),
ForeignKey('datastore_versions.id'))
backups.create_column(datastore_version_id)
示例8: upgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import create_column [as 别名]
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
# add column:
instances = Table('instances', meta, autoload=True)
instances.create_column(Column('tenant_id', String(36), nullable=True))
instances.create_column(Column('server_status', String(64)))
示例9: downgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import create_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()
示例10: upgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import create_column [as 别名]
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
# add column:
instances = Table('instances', meta, autoload=True)
instances.create_column(Column('deleted', Boolean()))
instances.create_column(Column('deleted_at', DateTime()))
示例11: upgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import create_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')
示例12: upgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import create_column [as 别名]
def upgrade(migrate_engine):
meta.bind = migrate_engine
instance_vip = Table('instance_vip', meta, autoload=True)
instance_vip.create_column(Column('virtual_instance_id', String(36)))
def update_instance_vips():
update(table = instance_vip, whereclause="deleted = 0",
values=dict(virtual_instance_id = instance_vip.c.instance_id)).execute()
update_instance_vips()
示例13: upgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import create_column [as 别名]
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
# add column:
instances = Table('instances', meta, autoload=True)
volume_size = Column('volume_size', Integer())
flavor_id = Column('flavor_id', String(36))
instances.create_column(flavor_id)
instances.create_column(volume_size)
示例14: upgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import create_column [as 别名]
def upgrade(migrate_engine):
meta.bind = migrate_engine
create_tables([datastores, datastore_versions])
# ----------------------------------------------------
# Fore. 2014/06/19 Not modify old schemas on Instance.
# ----------------------------------------------------
instances = Table('instances', meta, autoload=True)
# datastore_version_id = Column('datastore_version_id', String(36),
# ForeignKey('datastore_versions.id'))
datastore_version_id = Column('datastore_version_id', String(36), nullable = True)
instances.create_column(datastore_version_id)
示例15: downgrade
# 需要导入模块: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 别名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import create_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)