37 lines
976 B
Python
37 lines
976 B
Python
"""Added cars table
|
|
|
|
Revision ID: 6ea64b2c52be
|
|
Revises: 46b4c05512b3
|
|
Create Date: 2017-08-23 20:43:41.807113
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '6ea64b2c52be'
|
|
down_revision = '46b4c05512b3'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('car',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('name', sa.String(length=50), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.add_column(u'gas', sa.Column('car_id', sa.Integer(), nullable=True))
|
|
op.create_foreign_key(None, 'gas', 'car', ['car_id'], ['id'])
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_constraint(None, 'gas', type_='foreignkey')
|
|
op.drop_column(u'gas', 'car_id')
|
|
op.drop_table('car')
|
|
# ### end Alembic commands ###
|