本文整理汇总了Python中alembic.op.create_table方法的典型用法代码示例。如果您正苦于以下问题:Python op.create_table方法的具体用法?Python op.create_table怎么用?Python op.create_table使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类alembic.op
的用法示例。
在下文中一共展示了op.create_table方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_table [as 别名]
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('months',
sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('months_id_seq'::regclass)"), nullable=False),
sa.Column('month', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('year', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('department_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.ForeignKeyConstraint(['department_id'], ['departments.id'], name='months_department_id_fkey'),
sa.PrimaryKeyConstraint('id', name='months_pkey'),
postgresql_ignore_search_path=False
)
op.create_table('serviceTypes',
sa.Column('id', sa.INTEGER(), server_default=sa.text('nextval(\'"serviceTypes_id_seq"\'::regclass)'), nullable=False),
sa.Column('month_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('service_type', sa.VARCHAR(length=36), autoincrement=False, nullable=False),
sa.Column('count', sa.INTEGER(), autoincrement=False, nullable=True),
sa.ForeignKeyConstraint(['month_id'], ['months.id'], name='serviceTypes_month_id_fkey'),
sa.PrimaryKeyConstraint('id', name='serviceTypes_pkey')
)
op.drop_table('use_of_force_incidents')
### end Alembic commands ###
示例2: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_table [as 别名]
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('citizen_complaint',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('department_id', sa.Integer(), nullable=False),
sa.Column('opaque_id', sa.String(length=255), nullable=False),
sa.Column('occured_date', sa.DateTime(), nullable=True),
sa.Column('division', sa.String(length=255), nullable=True),
sa.Column('precinct', sa.String(length=255), nullable=True),
sa.Column('shift', sa.String(length=255), nullable=True),
sa.Column('beat', sa.String(length=255), nullable=True),
sa.Column('disposition', sa.String(length=255), nullable=True),
sa.Column('census_tract', sa.String(length=255), nullable=True),
sa.Column('resident_race', sa.String(length=255), nullable=True),
sa.Column('officer_race', sa.String(length=255), nullable=True),
sa.Column('resident_sex', sa.String(length=255), nullable=True),
sa.Column('officer_sex', sa.String(length=255), nullable=True),
sa.Column('officer_identifier', sa.String(length=255), nullable=True),
sa.Column('officer_years_of_service', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['department_id'], ['departments.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('opaque_id')
)
### end Alembic commands ###
示例3: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_table [as 别名]
def upgrade():
op.create_table(
'assaults_on_officers',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('department_id', sa.Integer(), nullable=False),
sa.Column('opaque_id', sa.String(length=255), nullable=False),
sa.Column('officer_identifier', sa.String(length=255), nullable=True),
sa.Column('service_type', sa.String(length=255), nullable=True),
sa.Column('force_type', sa.String(length=255), nullable=True),
sa.Column('assignment', sa.String(length=255), nullable=True),
sa.Column('arrest_made', sa.Boolean(), nullable=True),
sa.Column('officer_injured', sa.Boolean(), nullable=True),
sa.Column('officer_killed', sa.Boolean(), nullable=True),
sa.Column('report_filed', sa.Boolean(), nullable=True),
sa.ForeignKeyConstraint(['department_id'], ['departments.id'], ),
sa.PrimaryKeyConstraint('id')
)
示例4: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_table [as 别名]
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('users',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('username', sa.String(length=80), nullable=False),
sa.Column('email', sa.String(length=80), nullable=False),
sa.Column('password', sa.String(length=128), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.Column('first_name', sa.String(length=30), nullable=True),
sa.Column('last_name', sa.String(length=30), nullable=True),
sa.Column('active', sa.Boolean(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('email'),
sa.UniqueConstraint('username')
)
op.create_table('roles',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=80), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id')
)
### end Alembic commands ###
示例5: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_table [as 别名]
def upgrade():
op.create_table(
'network',
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('project_id', sa.String(length=255), nullable=True),
sa.Column('user_id', sa.String(length=255), nullable=True),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('uuid', sa.String(length=36), nullable=True),
sa.Column('network_id', sa.String(length=255), nullable=True),
sa.Column('neutron_net_id', sa.String(length=255), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('uuid', name='uniq_network0uuid'),
sa.UniqueConstraint('neutron_net_id',
name='uniq_network0neutron_net_id'),
mysql_charset='utf8',
mysql_engine='InnoDB'
)
示例6: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_table [as 别名]
def upgrade():
op.create_table(
'container_actions',
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('action', sa.String(length=255), nullable=True),
sa.Column('container_uuid', sa.String(length=36), nullable=False),
sa.Column('request_id', sa.String(length=255), nullable=True),
sa.Column('user_id', sa.String(length=255), nullable=True),
sa.Column('project_id', sa.String(length=255), nullable=True),
sa.Column('start_time', sa.DateTime(), nullable=True),
sa.Column('finish_time', sa.DateTime(), nullable=True),
sa.Column('message', sa.String(length=255), nullable=True),
sa.Index('container_uuid_idx', 'container_uuid'),
sa.Index('request_id_idx', 'request_id'),
sa.ForeignKeyConstraint(['container_uuid'], ['container.uuid'], ),
sa.PrimaryKeyConstraint('id')
)
示例7: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_table [as 别名]
def upgrade():
op.create_table(
'allocation',
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('resource_provider_id', sa.Integer(), nullable=False),
sa.Column('consumer_id', sa.String(36), nullable=False),
sa.Column('resource_class_id', sa.Integer(), nullable=False),
sa.Column('used', sa.Integer(), nullable=False),
sa.Column('is_nested', sa.Integer(), nullable=False),
sa.Column('blob', zun.db.sqlalchemy.models.JSONEncodedList(),
nullable=True),
sa.Index('allocation_resource_provider_class_used_idx',
'resource_provider_id', 'resource_class_id', 'used'),
sa.Index('allocation_consumer_id_idx', 'consumer_id'),
sa.Index('allocation_resource_class_id_idx', 'resource_class_id'),
sa.PrimaryKeyConstraint('id'),
)
示例8: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_table [as 别名]
def upgrade():
op.create_table(
'container',
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('project_id', sa.String(length=255), nullable=True),
sa.Column('user_id', sa.String(length=255), nullable=True),
sa.Column('uuid', sa.String(length=36), nullable=True),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('image', sa.String(length=255), nullable=True),
sa.Column('command', sa.String(length=255), nullable=True),
sa.Column('status', sa.String(length=20), nullable=True),
sa.Column('environment', zun.db.sqlalchemy.models.JSONEncodedDict(),
nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('uuid', name='uniq_container0uuid')
)
示例9: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_table [as 别名]
def upgrade():
op.create_table(
'exec_instance',
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), primary_key=True, nullable=False),
sa.Column('container_id', sa.Integer(), nullable=False),
sa.Column('exec_id', sa.String(255), nullable=False),
sa.Column('token', sa.String(255), nullable=True),
sa.Column('url', sa.String(255), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.ForeignKeyConstraint(['container_id'], ['container.id'],
ondelete='CASCADE'),
sa.UniqueConstraint('container_id', 'exec_id',
name='uniq_exec_instance0container_id_exec_id'),
)
示例10: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_table [as 别名]
def upgrade():
op.create_table(
'container_actions_events',
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('event', sa.String(length=255), nullable=True),
sa.Column('action_id', sa.Integer(), nullable=False),
sa.Column('start_time', sa.DateTime(), nullable=True),
sa.Column('finish_time', sa.DateTime(), nullable=True),
sa.Column('result', sa.String(length=255), nullable=True),
sa.Column('traceback', sa.Text(), nullable=True),
sa.Column('details', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['action_id'], ['container_actions.id'], ),
sa.PrimaryKeyConstraint('id')
)
示例11: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_table [as 别名]
def upgrade():
op.create_table(
'volume_mapping',
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('uuid', sa.String(36), nullable=False),
sa.Column('project_id', sa.String(length=255), nullable=True),
sa.Column('user_id', sa.String(length=255), nullable=True),
sa.Column('volume_id', sa.String(36), nullable=False),
sa.Column('volume_provider', sa.String(36), nullable=False),
sa.Column('container_uuid', sa.String(36), nullable=False),
sa.Column('container_path', sa.String(length=255), nullable=True),
sa.Column('connection_info', MediumText(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('uuid', name='uniq_volume0uuid'),
)
示例12: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_table [as 别名]
def upgrade():
op.create_table(
'registry',
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('project_id', sa.String(length=255), nullable=True),
sa.Column('user_id', sa.String(length=255), nullable=True),
sa.Column('uuid', sa.String(length=36), nullable=True),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('domain', sa.String(length=255), nullable=False),
sa.Column('username', sa.String(length=255), nullable=True),
sa.Column('password', sa.String(length=255), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('uuid', name='uniq_registry0uuid'),
mysql_charset='utf8',
mysql_engine='InnoDB'
)
示例13: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_table [as 别名]
def upgrade():
op.create_table(
'zun_service',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('report_count', sa.Integer(), nullable=False),
sa.Column('host', sa.String(length=255), nullable=True),
sa.Column('binary', sa.String(length=255), nullable=True),
sa.Column('disabled', sa.Boolean(), nullable=True),
sa.Column('disabled_reason', sa.String(length=255), nullable=True),
sa.Column('last_seen_up', sa.DateTime(), nullable=True),
sa.Column('forced_down', sa.Boolean(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('host', 'binary',
name='uniq_zun_service0host0binary')
)
示例14: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_table [as 别名]
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('fingerprint',
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('hostname', sa.String(length=255), nullable=True),
sa.Column('sha256_fingerprint', sa.String(length=255), nullable=True),
sa.Column('hashed_hostname', sa.String(length=255), nullable=True),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('user_id', 'hashed_hostname', name='_user_id_hashed_hostname_uc')
)
op.create_index(op.f('ix_fingerprint_hashed_hostname'), 'fingerprint', ['hashed_hostname'], unique=False)
op.create_index(op.f('ix_fingerprint_user_id'), 'fingerprint', ['user_id'], unique=False)
# ### end Alembic commands ###
示例15: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_table [as 别名]
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('task_result',
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('pull_mirror_id', sa.Integer(), nullable=True),
sa.Column('push_mirror_id', sa.Integer(), nullable=True),
sa.Column('task_id', sa.String(length=155), nullable=True),
sa.Column('status', sa.String(length=50), nullable=True),
sa.Column('task_name', sa.String(length=255), nullable=True),
sa.Column('invoked_by', sa.Integer(), nullable=True),
sa.Column('result', sa.PickleType(), nullable=True),
sa.Column('date_done', sa.DateTime(), nullable=True),
sa.Column('traceback', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['pull_mirror_id'], ['pull_mirror.id'], ),
sa.ForeignKeyConstraint(['push_mirror_id'], ['push_mirror.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('task_id')
)
op.create_index(op.f('ix_task_result_pull_mirror_id'), 'task_result', ['pull_mirror_id'], unique=False)
op.create_index(op.f('ix_task_result_push_mirror_id'), 'task_result', ['push_mirror_id'], unique=False)
# ### end Alembic commands ###