Add migrations.

This commit is contained in:
Stephan Porada 2019-08-06 14:28:19 +02:00
parent 6f5bf674c6
commit 2ed63d9a5f
2 changed files with 15 additions and 39 deletions

View File

@ -1,8 +1,8 @@
"""initial migration
"""initial
Revision ID: 717796966c8c
Revision ID: 0fcc4cb0447b
Revises:
Create Date: 2019-08-06 11:39:51.067875
Create Date: 2019-08-06 13:41:06.754193
"""
from alembic import op
@ -10,7 +10,7 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '717796966c8c'
revision = '0fcc4cb0447b'
down_revision = None
branch_labels = None
depends_on = None
@ -30,6 +30,7 @@ def upgrade():
op.create_table('users',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('confirmed', sa.Boolean(), nullable=True),
sa.Column('registration_date', sa.DateTime(), nullable=True),
sa.Column('email', sa.String(length=64), nullable=True),
sa.Column('password_hash', sa.String(length=128), nullable=True),
sa.Column('role_id', sa.Integer(), nullable=True),
@ -39,8 +40,17 @@ def upgrade():
)
op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
op.create_table('corpora',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('description', sa.String(length=64), nullable=True),
sa.Column('title', sa.String(length=32), nullable=True),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('jobs',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('creation_date', sa.DateTime(), nullable=True),
sa.Column('description', sa.String(length=64), nullable=True),
sa.Column('ressources', sa.String(length=255), nullable=True),
sa.Column('service', sa.String(length=64), nullable=True),
@ -57,6 +67,7 @@ def upgrade():
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('jobs')
op.drop_table('corpora')
op.drop_index(op.f('ix_users_username'), table_name='users')
op.drop_index(op.f('ix_users_email'), table_name='users')
op.drop_table('users')

View File

@ -1,35 +0,0 @@
"""Add corpora table
Revision ID: 60d474dea68f
Revises: 717796966c8c
Create Date: 2019-08-06 12:03:30.639380
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '60d474dea68f'
down_revision = '717796966c8c'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('corpora',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('description', sa.String(length=64), nullable=True),
sa.Column('title', sa.String(length=32), nullable=True),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('corpora')
# ### end Alembic commands ###