def upgrade():
op.execute(sa.schema.CreateSequence(sa.Sequence('pod_states_id_seq')))
op.add_column('pod_states', sa.Column('id', sa.Integer(), nullable=False,
server_default=sa.text("nextval('pod_states_id_seq'::regclass)")))
op.execute("ALTER TABLE pod_states DROP CONSTRAINT pod_states_pkey, "
"ADD CONSTRAINT pod_states_pkey PRIMARY KEY (id);")
op.add_column('container_states', sa.Column('exit_code', sa.Integer(), nullable=True))
op.add_column('container_states', sa.Column('pod_state_id', sa.Integer(), nullable=True))
op.add_column('container_states', sa.Column('reason', sa.Text(), nullable=True))
op.create_index('ix_pod_id_start_time', 'pod_states', ['pod_id', 'start_time'], unique=True)
op.create_foreign_key('container_states_pod_state_id_fkey', 'container_states',
'pod_states', ['pod_state_id'], ['id'])
upgrade_data()
op.alter_column('container_states', 'pod_state_id',
existing_type=sa.INTEGER(), nullable=False)
op.drop_constraint(u'container_states_pod_id_fkey', 'container_states',
type_='foreignkey')
op.drop_column('container_states', 'pod_id')
2e00e70316c0_link_container_and_pod_states.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录