2021-06-20 19:25:27 +02:00
|
|
|
"""Initial migration.
|
2021-06-06 22:25:10 +02:00
|
|
|
|
2021-07-05 20:39:49 +02:00
|
|
|
Revision ID: 1e1b2be49756
|
2021-06-06 22:25:10 +02:00
|
|
|
Revises:
|
2021-07-05 20:39:49 +02:00
|
|
|
Create Date: 2021-07-05 20:36:04.047270
|
2021-06-06 22:25:10 +02:00
|
|
|
|
|
|
|
"""
|
|
|
|
from alembic import op
|
|
|
|
import sqlalchemy as sa
|
|
|
|
|
|
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
2021-07-05 20:39:49 +02:00
|
|
|
revision = '1e1b2be49756'
|
2021-06-06 22:25:10 +02:00
|
|
|
down_revision = None
|
|
|
|
branch_labels = None
|
|
|
|
depends_on = None
|
|
|
|
|
|
|
|
|
|
|
|
def upgrade():
|
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
2021-06-07 17:26:07 +02:00
|
|
|
op.create_table('contacttype',
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('name', sa.String(length=25), nullable=False),
|
|
|
|
sa.PrimaryKeyConstraint('id')
|
|
|
|
)
|
2021-06-06 22:25:10 +02:00
|
|
|
op.create_table('language',
|
2021-06-07 22:04:03 +02:00
|
|
|
sa.Column('id', sa.String(length=2), nullable=False),
|
2021-06-06 22:25:10 +02:00
|
|
|
sa.Column('name', sa.String(length=25), nullable=False),
|
|
|
|
sa.PrimaryKeyConstraint('id')
|
|
|
|
)
|
2021-06-20 19:25:27 +02:00
|
|
|
op.create_table('profile',
|
2021-06-06 22:25:10 +02:00
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('nickname', sa.String(length=25), nullable=False),
|
|
|
|
sa.Column('pronouns', sa.String(length=25), nullable=True),
|
|
|
|
sa.Column('volunteerwork', sa.String(length=4000), nullable=True),
|
|
|
|
sa.Column('freetext', sa.String(length=4000), nullable=True),
|
2021-07-02 16:26:36 +02:00
|
|
|
sa.Column('visible', sa.Boolean(), nullable=False),
|
2021-06-07 17:26:07 +02:00
|
|
|
sa.Column('created', sa.DateTime(), nullable=False),
|
|
|
|
sa.Column('updated', sa.DateTime(), nullable=False),
|
2021-06-06 22:25:10 +02:00
|
|
|
sa.PrimaryKeyConstraint('id'),
|
|
|
|
sa.UniqueConstraint('nickname')
|
|
|
|
)
|
2021-06-20 19:25:27 +02:00
|
|
|
op.create_table('skill',
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('name', sa.String(length=25), nullable=False),
|
|
|
|
sa.PrimaryKeyConstraint('id'),
|
|
|
|
sa.UniqueConstraint('name')
|
|
|
|
)
|
2021-06-06 22:25:10 +02:00
|
|
|
op.create_table('address',
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
2021-06-12 12:07:51 +02:00
|
|
|
sa.Column('name', sa.String(length=25), nullable=True),
|
2021-06-06 22:25:10 +02:00
|
|
|
sa.Column('street', sa.String(length=25), nullable=True),
|
|
|
|
sa.Column('house_number', sa.String(length=10), nullable=True),
|
|
|
|
sa.Column('additional', sa.String(length=25), nullable=True),
|
|
|
|
sa.Column('postcode', sa.String(length=10), nullable=True),
|
|
|
|
sa.Column('city', sa.String(length=25), nullable=True),
|
|
|
|
sa.Column('country', sa.String(length=25), nullable=True),
|
2021-06-20 19:25:27 +02:00
|
|
|
sa.Column('profile_id', sa.Integer(), nullable=False),
|
|
|
|
sa.ForeignKeyConstraint(['profile_id'], ['profile.id'], ),
|
2021-06-06 22:25:10 +02:00
|
|
|
sa.PrimaryKeyConstraint('id')
|
|
|
|
)
|
2021-06-07 17:26:07 +02:00
|
|
|
op.create_table('contact',
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
2021-06-20 19:25:27 +02:00
|
|
|
sa.Column('profile_id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('contacttype_id', sa.Integer(), nullable=False),
|
2021-06-07 17:26:07 +02:00
|
|
|
sa.Column('content', sa.String(length=200), nullable=False),
|
|
|
|
sa.ForeignKeyConstraint(['contacttype_id'], ['contacttype.id'], ),
|
2021-06-20 19:25:27 +02:00
|
|
|
sa.ForeignKeyConstraint(['profile_id'], ['profile.id'], ),
|
2021-06-12 12:00:34 +02:00
|
|
|
sa.PrimaryKeyConstraint('id')
|
|
|
|
)
|
2021-06-20 19:25:27 +02:00
|
|
|
op.create_table('profile_language',
|
|
|
|
sa.Column('profile_id', sa.Integer(), nullable=False),
|
2021-06-12 09:46:21 +02:00
|
|
|
sa.Column('language_id', sa.Integer(), nullable=False),
|
2021-06-12 12:00:34 +02:00
|
|
|
sa.Column('level', sa.SmallInteger(), nullable=False),
|
2021-06-07 17:26:07 +02:00
|
|
|
sa.ForeignKeyConstraint(['language_id'], ['language.id'], ),
|
2021-06-20 19:25:27 +02:00
|
|
|
sa.ForeignKeyConstraint(['profile_id'], ['profile.id'], ),
|
|
|
|
sa.PrimaryKeyConstraint('profile_id', 'language_id')
|
2021-06-07 17:26:07 +02:00
|
|
|
)
|
2021-07-05 20:39:49 +02:00
|
|
|
op.create_table('profile_searchtopic',
|
|
|
|
sa.Column('profile_id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('skill_id', sa.Integer(), nullable=False),
|
|
|
|
sa.ForeignKeyConstraint(['profile_id'], ['profile.id'], ),
|
|
|
|
sa.ForeignKeyConstraint(['skill_id'], ['skill.id'], ),
|
|
|
|
sa.PrimaryKeyConstraint('profile_id', 'skill_id')
|
|
|
|
)
|
2021-06-20 19:25:27 +02:00
|
|
|
op.create_table('profile_skill',
|
|
|
|
sa.Column('profile_id', sa.Integer(), nullable=False),
|
2021-06-12 09:46:21 +02:00
|
|
|
sa.Column('skill_id', sa.Integer(), nullable=False),
|
2021-06-12 12:00:34 +02:00
|
|
|
sa.Column('level', sa.SmallInteger(), nullable=False),
|
2021-06-20 19:25:27 +02:00
|
|
|
sa.ForeignKeyConstraint(['profile_id'], ['profile.id'], ),
|
2021-06-06 22:25:10 +02:00
|
|
|
sa.ForeignKeyConstraint(['skill_id'], ['skill.id'], ),
|
2021-06-20 19:25:27 +02:00
|
|
|
sa.PrimaryKeyConstraint('profile_id', 'skill_id')
|
|
|
|
)
|
|
|
|
op.create_table('user',
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('auth_id', sa.String(length=50), nullable=False),
|
|
|
|
sa.Column('profile_id', sa.Integer(), nullable=True),
|
|
|
|
sa.ForeignKeyConstraint(['profile_id'], ['profile.id'], ),
|
|
|
|
sa.PrimaryKeyConstraint('id'),
|
|
|
|
sa.UniqueConstraint('auth_id')
|
|
|
|
)
|
|
|
|
op.create_table('token',
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('user_id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('token', sa.String(length=36), nullable=False),
|
2021-06-12 09:46:21 +02:00
|
|
|
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
2021-06-20 19:25:27 +02:00
|
|
|
sa.PrimaryKeyConstraint('id')
|
2021-06-06 22:25:10 +02:00
|
|
|
)
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
|
|
|
|
|
|
def downgrade():
|
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
2021-06-12 12:00:34 +02:00
|
|
|
op.drop_table('token')
|
2021-06-20 19:25:27 +02:00
|
|
|
op.drop_table('user')
|
|
|
|
op.drop_table('profile_skill')
|
2021-07-05 20:39:49 +02:00
|
|
|
op.drop_table('profile_searchtopic')
|
2021-06-20 19:25:27 +02:00
|
|
|
op.drop_table('profile_language')
|
2021-06-07 17:26:07 +02:00
|
|
|
op.drop_table('contact')
|
2021-06-06 22:25:10 +02:00
|
|
|
op.drop_table('address')
|
|
|
|
op.drop_table('skill')
|
2021-06-20 19:25:27 +02:00
|
|
|
op.drop_table('profile')
|
2021-06-06 22:25:10 +02:00
|
|
|
op.drop_table('language')
|
2021-06-07 17:26:07 +02:00
|
|
|
op.drop_table('contacttype')
|
2021-06-06 22:25:10 +02:00
|
|
|
# ### end Alembic commands ###
|