Skip to content

Commit

Permalink
Add missing migrations
Browse files Browse the repository at this point in the history
Signed-off-by: Kirill K. Smirnov <kirill.k.smirnov@gmail.com>
  • Loading branch information
KirillSmirnov committed May 13, 2023
1 parent fc17340 commit 81ce57b
Show file tree
Hide file tree
Showing 26 changed files with 1,890 additions and 0 deletions.
62 changes: 62 additions & 0 deletions src/migrations/versions/06bbb2e38dc7_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
"""empty message
Revision ID: 06bbb2e38dc7
Revises: 5f9063e0c023
Create Date: 2022-05-25 23:06:03.719594
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '06bbb2e38dc7'
down_revision = '5f9063e0c023'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('notification',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('type', sa.Integer(), nullable=False),
sa.Column('recipient', sa.Integer(), nullable=False),
sa.Column('title', sa.String(length=512), nullable=True),
sa.Column('content', sa.String(length=8192), nullable=True),
sa.ForeignKeyConstraint(['recipient'], ['users.id'], name=op.f('fk_notification_recipient_users')),
sa.PrimaryKeyConstraint('id', name=op.f('pk_notification'))
)

# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('summer_school', schema=None) as batch_op:
batch_op.alter_column('requirements',
existing_type=sa.VARCHAR(length=1024),
nullable=True)
batch_op.alter_column('advisors',
existing_type=sa.VARCHAR(length=1024),
nullable=True)
batch_op.alter_column('tech',
existing_type=sa.VARCHAR(length=1024),
nullable=True)
batch_op.alter_column('description',
existing_type=sa.VARCHAR(length=2048),
nullable=True)
batch_op.alter_column('project_name',
existing_type=sa.VARCHAR(length=1024),
nullable=True)

with op.batch_alter_table('staff', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('uq_staff_official_email'), type_='unique')

with op.batch_alter_table('post_vote', schema=None) as batch_op:
batch_op.alter_column('post_id',
existing_type=sa.INTEGER(),
nullable=False)

op.drop_table('notification')
# ### end Alembic commands ###
59 changes: 59 additions & 0 deletions src/migrations/versions/08dc170e61cc_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""empty message
Revision ID: 08dc170e61cc
Revises: 446c2bd5db60
Create Date: 2022-03-09 16:14:55.657600
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '08dc170e61cc'
down_revision = '446c2bd5db60'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('diploma_themes', schema=None) as batch_op:
batch_op.add_column(sa.Column('supervisor_thesis_id', sa.Integer(), nullable=True))
batch_op.create_foreign_key(batch_op.f('fk_diploma_themes_supervisor_thesis_id_users'), 'users', ['supervisor_thesis_id'], ['id'])

# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('summer_school', schema=None) as batch_op:
batch_op.alter_column('requirements',
existing_type=sa.VARCHAR(length=1024),
nullable=True)
batch_op.alter_column('advisors',
existing_type=sa.VARCHAR(length=1024),
nullable=True)
batch_op.alter_column('tech',
existing_type=sa.VARCHAR(length=1024),
nullable=True)
batch_op.alter_column('description',
existing_type=sa.VARCHAR(length=2048),
nullable=True)
batch_op.alter_column('project_name',
existing_type=sa.VARCHAR(length=1024),
nullable=True)

with op.batch_alter_table('staff', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('uq_staff_official_email'), type_='unique')

with op.batch_alter_table('post_vote', schema=None) as batch_op:
batch_op.alter_column('post_id',
existing_type=sa.INTEGER(),
nullable=False)

with op.batch_alter_table('diploma_themes', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('fk_diploma_themes_supervisor_thesis_id_users'), type_='foreignkey')
batch_op.drop_column('supervisor_thesis_id')

# ### end Alembic commands ###
77 changes: 77 additions & 0 deletions src/migrations/versions/169101fef7d5_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
"""empty message
Revision ID: 169101fef7d5
Revises: a05df4a2a54f
Create Date: 2022-10-18 21:46:57.781740
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '169101fef7d5'
down_revision = 'a05df4a2a54f'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###

with op.batch_alter_table('thesis_report', schema=None) as batch_op:
batch_op.add_column(sa.Column('comment', sa.String(length=2048), nullable=True))
batch_op.add_column(sa.Column('comment_time', sa.DateTime(), nullable=True))

# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('thesis_report', schema=None) as batch_op:
batch_op.drop_column('comment_time')
batch_op.drop_column('comment')

with op.batch_alter_table('summer_school', schema=None) as batch_op:
batch_op.alter_column('requirements',
existing_type=sa.VARCHAR(length=1024),
nullable=True)
batch_op.alter_column('advisors',
existing_type=sa.VARCHAR(length=1024),
nullable=True)
batch_op.alter_column('tech',
existing_type=sa.VARCHAR(length=1024),
nullable=True)
batch_op.alter_column('description',
existing_type=sa.VARCHAR(length=2048),
nullable=True)
batch_op.alter_column('project_name',
existing_type=sa.VARCHAR(length=1024),
nullable=True)

with op.batch_alter_table('staff', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('uq_staff_official_email'), type_='unique')

with op.batch_alter_table('post_vote', schema=None) as batch_op:
batch_op.alter_column('post_id',
existing_type=sa.INTEGER(),
nullable=False)

with op.batch_alter_table('deadline', schema=None) as batch_op:
batch_op.add_column(sa.Column('course', sa.INTEGER(), nullable=False))
batch_op.drop_constraint(batch_op.f('fk_deadline_worktype_id_worktype'), type_='foreignkey')
batch_op.drop_column('worktype_id')

with op.batch_alter_table('current_thesis', schema=None) as batch_op:
batch_op.add_column(sa.Column('course', sa.INTEGER(), nullable=True))

op.create_table('grants',
sa.Column('id', sa.INTEGER(), nullable=False),
sa.Column('name', sa.VARCHAR(length=1024), nullable=False),
sa.Column('description', sa.VARCHAR(length=2048), nullable=True),
sa.Column('amount', sa.VARCHAR(length=2048), nullable=False),
sa.Column('submission', sa.VARCHAR(length=2048), nullable=False),
sa.Column('contacts', sa.VARCHAR(length=2048), nullable=True),
sa.PrimaryKeyConstraint('id', name='pk_grants')
)
# ### end Alembic commands ###
90 changes: 90 additions & 0 deletions src/migrations/versions/1925f5327423_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
"""empty message
Revision ID: 1925f5327423
Revises: c05d8ad16025
Create Date: 2022-11-26 13:27:08.604498
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '1925f5327423'
down_revision = 'c05d8ad16025'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###

with op.batch_alter_table('thesis_report', schema=None) as batch_op:
batch_op.add_column(sa.Column('deleted', sa.Boolean(), nullable=True))

# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('thesis_report', schema=None) as batch_op:
batch_op.drop_column('deleted')

with op.batch_alter_table('summer_school', schema=None) as batch_op:
batch_op.alter_column('requirements',
existing_type=sa.VARCHAR(length=1024),
nullable=True)
batch_op.alter_column('advisors',
existing_type=sa.VARCHAR(length=1024),
nullable=True)
batch_op.alter_column('tech',
existing_type=sa.VARCHAR(length=1024),
nullable=True)
batch_op.alter_column('description',
existing_type=sa.VARCHAR(length=2048),
nullable=True)
batch_op.alter_column('project_name',
existing_type=sa.VARCHAR(length=1024),
nullable=True)

with op.batch_alter_table('staff', schema=None) as batch_op:
batch_op.drop_constraint(batch_op.f('uq_staff_official_email'), type_='unique')

with op.batch_alter_table('post_vote', schema=None) as batch_op:
batch_op.alter_column('post_id',
existing_type=sa.INTEGER(),
nullable=False)

with op.batch_alter_table('deadline', schema=None) as batch_op:
batch_op.alter_column('worktype_id',
existing_type=sa.INTEGER(),
nullable=True)

with op.batch_alter_table('current_thesis', schema=None) as batch_op:
batch_op.drop_column('status')
batch_op.drop_column('presentation_link')
batch_op.drop_column('text_link')
batch_op.drop_column('text_uri')
batch_op.drop_column('goal')

op.create_table('notification_account',
sa.Column('id', sa.INTEGER(), nullable=False),
sa.Column('recipient_id', sa.INTEGER(), nullable=False),
sa.Column('content', sa.VARCHAR(length=512), nullable=False),
sa.Column('time', sa.DATETIME(), nullable=True),
sa.Column('viewed', sa.BOOLEAN(), nullable=False),
sa.ForeignKeyConstraint(['recipient_id'], ['users.id'], name='fk_notification_account_recipient_id_users'),
sa.PrimaryKeyConstraint('id', name='pk_notification_account')
)
op.create_table('grants',
sa.Column('id', sa.INTEGER(), nullable=False),
sa.Column('name', sa.VARCHAR(length=1024), nullable=False),
sa.Column('description', sa.VARCHAR(length=2048), nullable=True),
sa.Column('amount', sa.VARCHAR(length=2048), nullable=False),
sa.Column('submission', sa.VARCHAR(length=2048), nullable=False),
sa.Column('contacts', sa.VARCHAR(length=2048), nullable=True),
sa.PrimaryKeyConstraint('id', name='pk_grants')
)
op.drop_table('thesis_task')
op.drop_table('notification_coursework')
# ### end Alembic commands ###
46 changes: 46 additions & 0 deletions src/migrations/versions/1d36e5ec34c6_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""empty message
Revision ID: 1d36e5ec34c6
Revises: 538ea31d3311
Create Date: 2022-02-08 15:28:55.456596
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '1d36e5ec34c6'
down_revision = '538ea31d3311'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('diploma_themes', sa.Column('requirements', sa.String(length=2048), nullable=True))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('summer_school', 'requirements',
existing_type=sa.VARCHAR(length=1024),
nullable=True)
op.alter_column('summer_school', 'advisors',
existing_type=sa.VARCHAR(length=1024),
nullable=True)
op.alter_column('summer_school', 'tech',
existing_type=sa.VARCHAR(length=1024),
nullable=True)
op.alter_column('summer_school', 'description',
existing_type=sa.VARCHAR(length=2048),
nullable=True)
op.alter_column('summer_school', 'project_name',
existing_type=sa.VARCHAR(length=1024),
nullable=True)
op.alter_column('post_vote', 'post_id',
existing_type=sa.INTEGER(),
nullable=False)
op.drop_column('diploma_themes', 'requirements')
# ### end Alembic commands ###

0 comments on commit 81ce57b

Please sign in to comment.