From 81ce57bc38e4701bf8781a368417151480f0e5d3 Mon Sep 17 00:00:00 2001 From: "Kirill K. Smirnov" Date: Sat, 13 May 2023 16:21:50 +0300 Subject: [PATCH] Add missing migrations Signed-off-by: Kirill K. Smirnov --- src/migrations/versions/06bbb2e38dc7_.py | 62 ++++++++++ src/migrations/versions/08dc170e61cc_.py | 59 +++++++++ src/migrations/versions/169101fef7d5_.py | 77 ++++++++++++ src/migrations/versions/1925f5327423_.py | 90 ++++++++++++++ src/migrations/versions/1d36e5ec34c6_.py | 46 +++++++ src/migrations/versions/1fe48662062e_.py | 98 +++++++++++++++ src/migrations/versions/25130df4ed9f_.py | 43 +++++++ .../33ca5df0bfc2_merging_two_heads.py | 24 ++++ src/migrations/versions/446c2bd5db60_.py | 68 +++++++++++ src/migrations/versions/538ea31d3311_.py | 100 +++++++++++++++ src/migrations/versions/54fd2c6e5760_.py | 60 +++++++++ src/migrations/versions/5f9063e0c023_.py | 58 +++++++++ src/migrations/versions/5ff2d0fa2fe6_.py | 89 ++++++++++++++ src/migrations/versions/726436b16db5_.py | 58 +++++++++ src/migrations/versions/84ec21521d43_.py | 89 ++++++++++++++ src/migrations/versions/89d48cd3318b_.py | 86 +++++++++++++ src/migrations/versions/925985497ccc_.py | 66 ++++++++++ src/migrations/versions/975cdf37ae8e_.py | 60 +++++++++ src/migrations/versions/a05df4a2a54f_.py | 74 +++++++++++ src/migrations/versions/c05d8ad16025_.py | 72 +++++++++++ src/migrations/versions/c250ebb1be35_.py | 90 ++++++++++++++ src/migrations/versions/c44ed75ba53d_.py | 89 ++++++++++++++ src/migrations/versions/c48f0da3462c_.py | 84 +++++++++++++ src/migrations/versions/cf8a829be2e0_.py | 76 ++++++++++++ src/migrations/versions/e24cafdefc27_.py | 115 ++++++++++++++++++ src/migrations/versions/e308c4667985_.py | 57 +++++++++ 26 files changed, 1890 insertions(+) create mode 100644 src/migrations/versions/06bbb2e38dc7_.py create mode 100644 src/migrations/versions/08dc170e61cc_.py create mode 100644 src/migrations/versions/169101fef7d5_.py create mode 100644 src/migrations/versions/1925f5327423_.py create mode 100644 src/migrations/versions/1d36e5ec34c6_.py create mode 100644 src/migrations/versions/1fe48662062e_.py create mode 100644 src/migrations/versions/25130df4ed9f_.py create mode 100644 src/migrations/versions/33ca5df0bfc2_merging_two_heads.py create mode 100644 src/migrations/versions/446c2bd5db60_.py create mode 100644 src/migrations/versions/538ea31d3311_.py create mode 100644 src/migrations/versions/54fd2c6e5760_.py create mode 100644 src/migrations/versions/5f9063e0c023_.py create mode 100644 src/migrations/versions/5ff2d0fa2fe6_.py create mode 100644 src/migrations/versions/726436b16db5_.py create mode 100644 src/migrations/versions/84ec21521d43_.py create mode 100644 src/migrations/versions/89d48cd3318b_.py create mode 100644 src/migrations/versions/925985497ccc_.py create mode 100644 src/migrations/versions/975cdf37ae8e_.py create mode 100644 src/migrations/versions/a05df4a2a54f_.py create mode 100644 src/migrations/versions/c05d8ad16025_.py create mode 100644 src/migrations/versions/c250ebb1be35_.py create mode 100644 src/migrations/versions/c44ed75ba53d_.py create mode 100644 src/migrations/versions/c48f0da3462c_.py create mode 100644 src/migrations/versions/cf8a829be2e0_.py create mode 100644 src/migrations/versions/e24cafdefc27_.py create mode 100644 src/migrations/versions/e308c4667985_.py diff --git a/src/migrations/versions/06bbb2e38dc7_.py b/src/migrations/versions/06bbb2e38dc7_.py new file mode 100644 index 00000000..57d7bfb3 --- /dev/null +++ b/src/migrations/versions/06bbb2e38dc7_.py @@ -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 ### diff --git a/src/migrations/versions/08dc170e61cc_.py b/src/migrations/versions/08dc170e61cc_.py new file mode 100644 index 00000000..1490503f --- /dev/null +++ b/src/migrations/versions/08dc170e61cc_.py @@ -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 ### diff --git a/src/migrations/versions/169101fef7d5_.py b/src/migrations/versions/169101fef7d5_.py new file mode 100644 index 00000000..d76a5a14 --- /dev/null +++ b/src/migrations/versions/169101fef7d5_.py @@ -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 ### diff --git a/src/migrations/versions/1925f5327423_.py b/src/migrations/versions/1925f5327423_.py new file mode 100644 index 00000000..ce15023b --- /dev/null +++ b/src/migrations/versions/1925f5327423_.py @@ -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 ### diff --git a/src/migrations/versions/1d36e5ec34c6_.py b/src/migrations/versions/1d36e5ec34c6_.py new file mode 100644 index 00000000..91d4553f --- /dev/null +++ b/src/migrations/versions/1d36e5ec34c6_.py @@ -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 ### diff --git a/src/migrations/versions/1fe48662062e_.py b/src/migrations/versions/1fe48662062e_.py new file mode 100644 index 00000000..c7f878cf --- /dev/null +++ b/src/migrations/versions/1fe48662062e_.py @@ -0,0 +1,98 @@ +"""empty message + +Revision ID: 1fe48662062e +Revises: c48f0da3462c +Create Date: 2023-03-29 16:36:01.901818 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '1fe48662062e' +down_revision = 'c48f0da3462c' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('notification_practice', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('recipient_id', sa.Integer(), nullable=False), + sa.Column('content', sa.String(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=op.f('fk_notification_practice_recipient_id_users')), + sa.PrimaryKeyConstraint('id', name=op.f('pk_notification_practice')) + ) + + # ### 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('deadline', schema=None) as batch_op: + batch_op.alter_column('worktype_id', + existing_type=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') + ) + op.create_table('_alembic_tmp_deadline', + sa.Column('id', sa.INTEGER(), nullable=False), + sa.Column('area_id', sa.INTEGER(), nullable=False), + sa.Column('choose_topic', sa.DATETIME(), nullable=True), + sa.Column('submit_work_for_review', sa.DATETIME(), nullable=True), + sa.Column('upload_reviews', sa.DATETIME(), nullable=True), + sa.Column('pre_defense', sa.DATETIME(), nullable=True), + sa.Column('defense', sa.DATETIME(), nullable=True), + sa.Column('worktype_id', sa.INTEGER(), nullable=False), + sa.ForeignKeyConstraint(['area_id'], ['areas_of_study.id'], name='fk_deadline_area_id_areas_of_study'), + sa.ForeignKeyConstraint(['worktype_id'], ['worktype.id'], name='fk_deadline_worktype_id_worktype'), + sa.PrimaryKeyConstraint('id', name='pk_deadline') + ) + op.create_table('notification_coursework', + 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_coursework_recipient_id_users'), + sa.PrimaryKeyConstraint('id', name='pk_notification_coursework') + ) + op.drop_table('notification_practice') + # ### end Alembic commands ### diff --git a/src/migrations/versions/25130df4ed9f_.py b/src/migrations/versions/25130df4ed9f_.py new file mode 100644 index 00000000..c5d43749 --- /dev/null +++ b/src/migrations/versions/25130df4ed9f_.py @@ -0,0 +1,43 @@ +"""empty message + +Revision ID: 25130df4ed9f +Revises: +Create Date: 2022-01-20 15:48:13.864008 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '25130df4ed9f' +down_revision = None +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('users', sa.Column('role', sa.Integer(), server_default=sa.schema.DefaultClause("0"), nullable=False)) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('users', 'role') + 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) + # ### end Alembic commands ### diff --git a/src/migrations/versions/33ca5df0bfc2_merging_two_heads.py b/src/migrations/versions/33ca5df0bfc2_merging_two_heads.py new file mode 100644 index 00000000..2f6fb376 --- /dev/null +++ b/src/migrations/versions/33ca5df0bfc2_merging_two_heads.py @@ -0,0 +1,24 @@ +"""merging two heads + +Revision ID: 33ca5df0bfc2 +Revises: 975cdf37ae8e, c4e88555c985 +Create Date: 2022-10-11 14:21:26.150716 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '33ca5df0bfc2' +down_revision = ('975cdf37ae8e', 'c4e88555c985') +branch_labels = None +depends_on = None + + +def upgrade(): + pass + + +def downgrade(): + pass diff --git a/src/migrations/versions/446c2bd5db60_.py b/src/migrations/versions/446c2bd5db60_.py new file mode 100644 index 00000000..cfc0f13a --- /dev/null +++ b/src/migrations/versions/446c2bd5db60_.py @@ -0,0 +1,68 @@ +"""empty message + +Revision ID: 446c2bd5db60 +Revises: cf8a829be2e0 +Create Date: 2022-02-15 10:19:52.471157 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '446c2bd5db60' +down_revision = 'cf8a829be2e0' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('post_type', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('type', sa.Integer(), nullable=False), + sa.Column('name', sa.String(length=512), nullable=False), + sa.PrimaryKeyConstraint('id', name=op.f('pk_post_type')) + ) + + with op.batch_alter_table('posts', schema=None) as batch_op: + batch_op.add_column(sa.Column('type_id', sa.Integer(), nullable=True)) + batch_op.create_foreign_key(batch_op.f('fk_posts_type_id_post_type'), 'post_type', ['type_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('posts', schema=None) as batch_op: + batch_op.drop_constraint(batch_op.f('fk_posts_type_id_post_type'), type_='foreignkey') + batch_op.drop_column('type_id') + + 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('post_type') + # ### end Alembic commands ### diff --git a/src/migrations/versions/538ea31d3311_.py b/src/migrations/versions/538ea31d3311_.py new file mode 100644 index 00000000..596862a6 --- /dev/null +++ b/src/migrations/versions/538ea31d3311_.py @@ -0,0 +1,100 @@ +"""empty message + +Revision ID: 538ea31d3311 +Revises: 25130df4ed9f +Create Date: 2022-02-04 08:52:12.130525 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '538ea31d3311' +down_revision = '25130df4ed9f' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('company', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('name', sa.String(length=512), nullable=False), + sa.Column('logo_uri', sa.String(length=512), nullable=True), + sa.PrimaryKeyConstraint('id') + ) + op.create_table('diploma_themes_tags', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('name', sa.String(length=64), nullable=False), + sa.PrimaryKeyConstraint('id') + ) + op.create_table('themes_level', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('level', sa.String(length=512), nullable=False), + sa.PrimaryKeyConstraint('id') + ) + op.create_table('diploma_themes', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('title', sa.String(length=512), nullable=False), + sa.Column('description', sa.String(length=2048), nullable=True), + sa.Column('status', sa.Integer(), nullable=False), + sa.Column('comment', sa.String(length=2048), nullable=True), + sa.Column('level_id', sa.Integer(), nullable=True), + sa.Column('company_id', sa.Integer(), nullable=True), + sa.Column('author_id', sa.Integer(), nullable=False), + sa.Column('supervisor_id', sa.Integer(), nullable=True), + sa.Column('consultant_id', sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(['author_id'], ['users.id'], ), + sa.ForeignKeyConstraint(['company_id'], ['company.id'], ), + sa.ForeignKeyConstraint(['consultant_id'], ['users.id'], ), + sa.ForeignKeyConstraint(['level_id'], ['themes_level.id'], ), + sa.ForeignKeyConstraint(['supervisor_id'], ['users.id'], ), + sa.PrimaryKeyConstraint('id') + ) + op.create_table('diploma_themes_tag', + sa.Column('diploma_themes_tag_id', sa.Integer(), nullable=False), + sa.Column('diploma_themes_id', sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(['diploma_themes_id'], ['diploma_themes.id'], ), + sa.ForeignKeyConstraint(['diploma_themes_tag_id'], ['diploma_themes_tags.id'], ), + sa.PrimaryKeyConstraint('diploma_themes_tag_id', 'diploma_themes_id') + ) + op.drop_table('grants') + # ### 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.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') + ) + op.drop_table('diploma_themes_tag') + op.drop_table('diploma_themes') + op.drop_table('themes_level') + op.drop_table('diploma_themes_tags') + op.drop_table('company') + # ### end Alembic commands ### diff --git a/src/migrations/versions/54fd2c6e5760_.py b/src/migrations/versions/54fd2c6e5760_.py new file mode 100644 index 00000000..b182e308 --- /dev/null +++ b/src/migrations/versions/54fd2c6e5760_.py @@ -0,0 +1,60 @@ +"""empty message + +Revision ID: 54fd2c6e5760 +Revises: 84ec21521d43 +Create Date: 2022-05-02 10:36:18.775422 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '54fd2c6e5760' +down_revision = '84ec21521d43' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + + with op.batch_alter_table('thesis', schema=None) as batch_op: + batch_op.add_column(sa.Column('area_id', sa.Integer(), nullable=True)) + batch_op.create_foreign_key(batch_op.f('fk_thesis_area_id_areas_of_study'), 'areas_of_study', ['area_id'], ['id']) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('thesis', schema=None) as batch_op: + batch_op.drop_constraint(batch_op.f('fk_thesis_area_id_areas_of_study'), type_='foreignkey') + batch_op.drop_column('area_id') + + 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) + + # ### end Alembic commands ### diff --git a/src/migrations/versions/5f9063e0c023_.py b/src/migrations/versions/5f9063e0c023_.py new file mode 100644 index 00000000..23aa7f8a --- /dev/null +++ b/src/migrations/versions/5f9063e0c023_.py @@ -0,0 +1,58 @@ +"""empty message + +Revision ID: 5f9063e0c023 +Revises: 925985497ccc +Create Date: 2022-05-20 01:04:21.444079 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '5f9063e0c023' +down_revision = '925985497ccc' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('promo_code', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('code', sa.String(length=512), nullable=False), + sa.PrimaryKeyConstraint('id', name=op.f('pk_promo_code')) + ) + + # ### 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('promo_code') + # ### end Alembic commands ### diff --git a/src/migrations/versions/5ff2d0fa2fe6_.py b/src/migrations/versions/5ff2d0fa2fe6_.py new file mode 100644 index 00000000..71fe5abd --- /dev/null +++ b/src/migrations/versions/5ff2d0fa2fe6_.py @@ -0,0 +1,89 @@ +"""empty message + +Revision ID: 5ff2d0fa2fe6 +Revises: 89d48cd3318b +Create Date: 2022-10-18 21:55:30.573308 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '5ff2d0fa2fe6' +down_revision = '89d48cd3318b' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('current_thesis', schema=None) as batch_op: + batch_op.drop_column('course') + + with op.batch_alter_table('deadline', schema=None) as batch_op: + batch_op.add_column(sa.Column('worktype_id', sa.Integer(), nullable=True)) + batch_op.create_foreign_key(batch_op.f('fk_deadline_worktype_id_worktype'), 'worktype', ['worktype_id'], ['id']) + batch_op.drop_column('course') + + # ### 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('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') + ) + op.create_table('_alembic_tmp_deadline', + sa.Column('id', sa.INTEGER(), nullable=False), + sa.Column('area_id', sa.INTEGER(), nullable=False), + sa.Column('choose_topic', sa.DATETIME(), nullable=True), + sa.Column('submit_work_for_review', sa.DATETIME(), nullable=True), + sa.Column('upload_reviews', sa.DATETIME(), nullable=True), + sa.Column('pre_defense', sa.DATETIME(), nullable=True), + sa.Column('defense', sa.DATETIME(), nullable=True), + sa.Column('worktype_id', sa.INTEGER(), nullable=False), + sa.ForeignKeyConstraint(['area_id'], ['areas_of_study.id'], name='fk_deadline_area_id_areas_of_study'), + sa.ForeignKeyConstraint(['worktype_id'], ['worktype.id'], name='fk_deadline_worktype_id_worktype'), + sa.PrimaryKeyConstraint('id', name='pk_deadline') + ) + # ### end Alembic commands ### diff --git a/src/migrations/versions/726436b16db5_.py b/src/migrations/versions/726436b16db5_.py new file mode 100644 index 00000000..a6f097f7 --- /dev/null +++ b/src/migrations/versions/726436b16db5_.py @@ -0,0 +1,58 @@ +"""empty message + +Revision ID: 726436b16db5 +Revises: c250ebb1be35 +Create Date: 2022-05-04 11:26:08.700016 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '726436b16db5' +down_revision = 'c250ebb1be35' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + + with op.batch_alter_table('thesis_review', schema=None) as batch_op: + batch_op.add_column(sa.Column('review_file_uri', sa.String(length=512), nullable=True)) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('thesis_review', schema=None) as batch_op: + batch_op.drop_column('review_file_uri') + + 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) + + # ### end Alembic commands ### diff --git a/src/migrations/versions/84ec21521d43_.py b/src/migrations/versions/84ec21521d43_.py new file mode 100644 index 00000000..0088b801 --- /dev/null +++ b/src/migrations/versions/84ec21521d43_.py @@ -0,0 +1,89 @@ +"""empty message + +Revision ID: 84ec21521d43 +Revises: 08dc170e61cc +Create Date: 2022-04-26 11:16:58.627399 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '84ec21521d43' +down_revision = '08dc170e61cc' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('areas_of_study', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('area', sa.String(length=512), nullable=False), + sa.PrimaryKeyConstraint('id', name=op.f('pk_areas_of_study')) + ) + op.create_table('thesis_review', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('thesis_id', sa.Integer(), nullable=True), + sa.Column('o1', sa.Integer(), nullable=True), + sa.Column('o1_comment', sa.String(length=1024), nullable=True), + sa.Column('o2', sa.Integer(), nullable=True), + sa.Column('o2_comment', sa.String(length=1024), nullable=True), + sa.Column('t1', sa.Integer(), nullable=True), + sa.Column('t1_comment', sa.String(length=1024), nullable=True), + sa.Column('t2', sa.Integer(), nullable=True), + sa.Column('t2_comment', sa.String(length=1024), nullable=True), + sa.Column('p1', sa.Integer(), nullable=True), + sa.Column('p1_comment', sa.String(length=1024), nullable=True), + sa.Column('p2', sa.Integer(), nullable=True), + sa.Column('p2_comment', sa.String(length=1024), nullable=True), + sa.Column('verdict', sa.Integer(), nullable=False), + sa.Column('overall_comment', sa.String(length=1024), nullable=True), + sa.ForeignKeyConstraint(['thesis_id'], ['thesis.id'], name=op.f('fk_thesis_review_thesis_id_thesis')), + sa.PrimaryKeyConstraint('id', name=op.f('pk_thesis_review')) + ) + + with op.batch_alter_table('thesis', schema=None) as batch_op: + batch_op.add_column(sa.Column('author_id', sa.Integer(), nullable=True)) + batch_op.add_column(sa.Column('review_status', sa.Integer(), nullable=True)) + batch_op.create_foreign_key(batch_op.f('fk_thesis_author_id_users'), 'users', ['author_id'], ['id']) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('thesis', schema=None) as batch_op: + batch_op.drop_constraint(batch_op.f('fk_thesis_author_id_users'), type_='foreignkey') + batch_op.drop_column('review_status') + batch_op.drop_column('author_id') + + 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('thesis_review') + op.drop_table('areas_of_study') + # ### end Alembic commands ### diff --git a/src/migrations/versions/89d48cd3318b_.py b/src/migrations/versions/89d48cd3318b_.py new file mode 100644 index 00000000..8b6e5e16 --- /dev/null +++ b/src/migrations/versions/89d48cd3318b_.py @@ -0,0 +1,86 @@ +"""empty message + +Revision ID: 89d48cd3318b +Revises: 169101fef7d5 +Create Date: 2022-10-18 21:52:34.957231 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '89d48cd3318b' +down_revision = '169101fef7d5' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + + with op.batch_alter_table('deadline', schema=None) as batch_op: + batch_op.create_foreign_key(batch_op.f('fk_deadline_worktype_id_worktype'), 'worktype', ['worktype_id'], ['id']) + batch_op.drop_column('course') + + # ### 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('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('_alembic_tmp_deadline', + sa.Column('id', sa.INTEGER(), nullable=False), + sa.Column('area_id', sa.INTEGER(), nullable=False), + sa.Column('choose_topic', sa.DATETIME(), nullable=True), + sa.Column('submit_work_for_review', sa.DATETIME(), nullable=True), + sa.Column('upload_reviews', sa.DATETIME(), nullable=True), + sa.Column('pre_defense', sa.DATETIME(), nullable=True), + sa.Column('defense', sa.DATETIME(), nullable=True), + sa.Column('worktype_id', sa.INTEGER(), nullable=False), + sa.ForeignKeyConstraint(['area_id'], ['areas_of_study.id'], name='fk_deadline_area_id_areas_of_study'), + sa.ForeignKeyConstraint(['worktype_id'], ['worktype.id'], name='fk_deadline_worktype_id_worktype'), + sa.PrimaryKeyConstraint('id', name='pk_deadline') + ) + 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 ### diff --git a/src/migrations/versions/925985497ccc_.py b/src/migrations/versions/925985497ccc_.py new file mode 100644 index 00000000..6150abf3 --- /dev/null +++ b/src/migrations/versions/925985497ccc_.py @@ -0,0 +1,66 @@ +"""empty message + +Revision ID: 925985497ccc +Revises: 726436b16db5 +Create Date: 2022-05-04 20:22:07.293786 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '925985497ccc' +down_revision = '726436b16db5' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('thesis_on_review_worktype', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('type', sa.String(length=255), nullable=False), + sa.PrimaryKeyConstraint('id', name=op.f('pk_thesis_on_review_worktype')) + ) + + with op.batch_alter_table('thesis_on_review', schema=None) as batch_op: + batch_op.add_column(sa.Column('thesis_on_review_type_id', sa.Integer(), nullable=True)) + batch_op.create_foreign_key(batch_op.f('fk_thesis_on_review_thesis_on_review_type_id_thesis_on_review_worktype'), 'thesis_on_review_worktype', ['thesis_on_review_type_id'], ['id']) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('thesis_on_review', schema=None) as batch_op: + batch_op.drop_constraint(batch_op.f('fk_thesis_on_review_thesis_on_review_type_id_thesis_on_review_worktype'), type_='foreignkey') + batch_op.drop_column('thesis_on_review_type_id') + + 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('thesis_on_review_worktype') + # ### end Alembic commands ### diff --git a/src/migrations/versions/975cdf37ae8e_.py b/src/migrations/versions/975cdf37ae8e_.py new file mode 100644 index 00000000..ad198698 --- /dev/null +++ b/src/migrations/versions/975cdf37ae8e_.py @@ -0,0 +1,60 @@ +"""empty message + +Revision ID: 975cdf37ae8e +Revises: e308c4667985 +Create Date: 2022-08-23 16:08:27.816212 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '975cdf37ae8e' +down_revision = 'e308c4667985' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + + with op.batch_alter_table('thesis', schema=None) as batch_op: + batch_op.add_column(sa.Column('download_thesis', sa.Integer(), nullable=True)) + batch_op.add_column(sa.Column('download_presentation', sa.Integer(), nullable=True)) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('thesis', schema=None) as batch_op: + batch_op.drop_column('download_presentation') + batch_op.drop_column('download_thesis') + + 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) + + # ### end Alembic commands ### diff --git a/src/migrations/versions/a05df4a2a54f_.py b/src/migrations/versions/a05df4a2a54f_.py new file mode 100644 index 00000000..57c7a782 --- /dev/null +++ b/src/migrations/versions/a05df4a2a54f_.py @@ -0,0 +1,74 @@ +"""empty message + +Revision ID: a05df4a2a54f +Revises: e24cafdefc27 +Create Date: 2022-10-13 18:08:57.861152 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'a05df4a2a54f' +down_revision = 'e24cafdefc27' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('internship_tag', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('tag', sa.String(length=100), nullable=False), + sa.PrimaryKeyConstraint('id', name=op.f('pk_internship_tag')) + ) + op.create_table('internships_tag', + sa.Column('internships_tag_id', sa.Integer(), nullable=False), + sa.Column('internships_id', sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(['internships_id'], ['internships.id'], name=op.f('fk_internships_tag_internships_id_internships')), + sa.ForeignKeyConstraint(['internships_tag_id'], ['internship_tag.id'], name=op.f('fk_internships_tag_internships_tag_id_internship_tag')), + sa.PrimaryKeyConstraint('internships_tag_id', 'internships_id', name=op.f('pk_internships_tag')) + ) + # ### 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.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('internships_tag') + op.drop_table('internship_tag') + # ### end Alembic commands ### diff --git a/src/migrations/versions/c05d8ad16025_.py b/src/migrations/versions/c05d8ad16025_.py new file mode 100644 index 00000000..fc88ce95 --- /dev/null +++ b/src/migrations/versions/c05d8ad16025_.py @@ -0,0 +1,72 @@ +"""empty message + +Revision ID: c05d8ad16025 +Revises: 5ff2d0fa2fe6 +Create Date: 2022-11-14 21:29:26.982919 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'c05d8ad16025' +down_revision = '5ff2d0fa2fe6' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + + with op.batch_alter_table('thesis', schema=None) as batch_op: + batch_op.add_column(sa.Column('text', sa.Text(), nullable=True)) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('thesis', schema=None) as batch_op: + batch_op.drop_column('text') + + 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) + + 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 ### diff --git a/src/migrations/versions/c250ebb1be35_.py b/src/migrations/versions/c250ebb1be35_.py new file mode 100644 index 00000000..b1dfbc02 --- /dev/null +++ b/src/migrations/versions/c250ebb1be35_.py @@ -0,0 +1,90 @@ +"""empty message + +Revision ID: c250ebb1be35 +Revises: 54fd2c6e5760 +Create Date: 2022-05-03 22:06:38.549935 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'c250ebb1be35' +down_revision = '54fd2c6e5760' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('reviewer', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('user_id', sa.Integer(), nullable=False), + sa.Column('company_id', sa.Integer(), nullable=True), + sa.ForeignKeyConstraint(['company_id'], ['company.id'], name=op.f('fk_reviewer_company_id_company')), + sa.ForeignKeyConstraint(['user_id'], ['users.id'], name=op.f('fk_reviewer_user_id_users')), + sa.PrimaryKeyConstraint('id', name=op.f('pk_reviewer')) + ) + op.create_table('thesis_on_review', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('type_id', sa.Integer(), nullable=False), + sa.Column('area_id', sa.Integer(), nullable=True), + sa.Column('name_ru', sa.String(length=512), nullable=False), + sa.Column('text_uri', sa.String(length=512), nullable=True), + sa.Column('presentation_uri', sa.String(length=512), nullable=True), + sa.Column('source_uri', sa.String(length=512), nullable=True), + sa.Column('author_id', sa.Integer(), nullable=True), + sa.Column('reviewer_id', sa.Integer(), nullable=True), + sa.Column('supervisor_id', sa.Integer(), nullable=True), + sa.Column('review_status', sa.Integer(), nullable=True), + sa.ForeignKeyConstraint(['area_id'], ['areas_of_study.id'], name=op.f('fk_thesis_on_review_area_id_areas_of_study')), + sa.ForeignKeyConstraint(['author_id'], ['users.id'], name=op.f('fk_thesis_on_review_author_id_users')), + sa.ForeignKeyConstraint(['reviewer_id'], ['reviewer.id'], name=op.f('fk_thesis_on_review_reviewer_id_reviewer')), + sa.ForeignKeyConstraint(['supervisor_id'], ['staff.id'], name=op.f('fk_thesis_on_review_supervisor_id_staff')), + sa.ForeignKeyConstraint(['type_id'], ['worktype.id'], name=op.f('fk_thesis_on_review_type_id_worktype')), + sa.PrimaryKeyConstraint('id', name=op.f('pk_thesis_on_review')) + ) + + + with op.batch_alter_table('thesis_review', schema=None) as batch_op: + batch_op.add_column(sa.Column('thesis_on_review_id', sa.Integer(), nullable=True)) + batch_op.create_foreign_key(batch_op.f('fk_thesis_review_thesis_on_review_id_thesis_on_review'), 'thesis_on_review', ['thesis_on_review_id'], ['id']) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('thesis_review', schema=None) as batch_op: + batch_op.drop_constraint(batch_op.f('fk_thesis_review_thesis_on_review_id_thesis_on_review'), type_='foreignkey') + batch_op.drop_column('thesis_on_review_id') + + 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('thesis_on_review') + op.drop_table('reviewer') + # ### end Alembic commands ### diff --git a/src/migrations/versions/c44ed75ba53d_.py b/src/migrations/versions/c44ed75ba53d_.py new file mode 100644 index 00000000..8d228ae5 --- /dev/null +++ b/src/migrations/versions/c44ed75ba53d_.py @@ -0,0 +1,89 @@ +"""empty message + +Revision ID: c44ed75ba53d +Revises: 06bbb2e38dc7 +Create Date: 2022-06-05 22:23:19.436738 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'c44ed75ba53d' +down_revision = '06bbb2e38dc7' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('internship_company', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('name', sa.String(length=512), nullable=False), + sa.Column('logo_uri', sa.String(length=512), nullable=True), + sa.PrimaryKeyConstraint('id', name=op.f('pk_internship_company')) + ) + op.create_table('internship_format', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('format', sa.String(length=100), nullable=False), + sa.PrimaryKeyConstraint('id', name=op.f('pk_internship_format')) + ) + op.create_table('internships', + sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('name_vacancy', sa.String(length=70), nullable=False), + sa.Column('salary', sa.String(length=30), nullable=False), + sa.Column('company_id', sa.Integer(), nullable=True), + sa.Column('requirements', sa.Text(), nullable=False), + sa.Column('date', sa.DateTime(), nullable=True), + sa.Column('more_inf', sa.String(), nullable=True), + sa.Column('description', sa.String(), nullable=True), + sa.Column('location', sa.String(length=50), nullable=True), + sa.Column('author_id', sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(['author_id'], ['users.id'], name=op.f('fk_internships_author_id_users')), + sa.ForeignKeyConstraint(['company_id'], ['internship_company.id'], name=op.f('fk_internships_company_id_internship_company')), + sa.PrimaryKeyConstraint('id', name=op.f('pk_internships')) + ) + op.create_table('internships_format', + sa.Column('internships_format_id', sa.Integer(), nullable=False), + sa.Column('internships_id', sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(['internships_format_id'], ['internship_format.id'], name=op.f('fk_internships_format_internships_format_id_internship_format')), + sa.ForeignKeyConstraint(['internships_id'], ['internships.id'], name=op.f('fk_internships_format_internships_id_internships')), + sa.PrimaryKeyConstraint('internships_format_id', 'internships_id', name=op.f('pk_internships_format')) + ) + + # ### 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('internships_format') + op.drop_table('internships') + op.drop_table('internship_format') + op.drop_table('internship_company') + # ### end Alembic commands ### diff --git a/src/migrations/versions/c48f0da3462c_.py b/src/migrations/versions/c48f0da3462c_.py new file mode 100644 index 00000000..6983a907 --- /dev/null +++ b/src/migrations/versions/c48f0da3462c_.py @@ -0,0 +1,84 @@ +"""empty message + +Revision ID: c48f0da3462c +Revises: 1925f5327423 +Create Date: 2022-12-15 09:50:45.422041 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'c48f0da3462c' +down_revision = '1925f5327423' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('thesis_on_review', schema=None) as batch_op: + batch_op.add_column(sa.Column('deleted', sa.Integer(), nullable=True)) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('thesis_on_review', 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) + + op.create_table('_alembic_tmp_deadline', + sa.Column('id', sa.INTEGER(), nullable=False), + sa.Column('area_id', sa.INTEGER(), nullable=False), + sa.Column('choose_topic', sa.DATETIME(), nullable=True), + sa.Column('submit_work_for_review', sa.DATETIME(), nullable=True), + sa.Column('upload_reviews', sa.DATETIME(), nullable=True), + sa.Column('pre_defense', sa.DATETIME(), nullable=True), + sa.Column('defense', sa.DATETIME(), nullable=True), + sa.Column('worktype_id', sa.INTEGER(), nullable=False), + sa.ForeignKeyConstraint(['area_id'], ['areas_of_study.id'], name='fk_deadline_area_id_areas_of_study'), + sa.ForeignKeyConstraint(['worktype_id'], ['worktype.id'], name='fk_deadline_worktype_id_worktype'), + sa.PrimaryKeyConstraint('id', name='pk_deadline') + ) + 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 ### diff --git a/src/migrations/versions/cf8a829be2e0_.py b/src/migrations/versions/cf8a829be2e0_.py new file mode 100644 index 00000000..0ef0606a --- /dev/null +++ b/src/migrations/versions/cf8a829be2e0_.py @@ -0,0 +1,76 @@ +"""empty message + +Revision ID: cf8a829be2e0 +Revises: 1d36e5ec34c6 +Create Date: 2022-02-10 17:53:52.829147 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'cf8a829be2e0' +down_revision = '1d36e5ec34c6' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + #op.create_table('diploma_themes_level', + #sa.Column('themes_level_id', sa.Integer(), nullable=False), + #sa.Column('diploma_themes_id', sa.Integer(), nullable=False), + #sa.ForeignKeyConstraint(['diploma_themes_id'], ['diploma_themes.id'], name=op.f('fk_diploma_themes_level_diploma_themes_id_diploma_themes')), + #sa.ForeignKeyConstraint(['themes_level_id'], ['themes_level.id'], name=op.f('fk_diploma_themes_level_themes_level_id_themes_level')), + #sa.PrimaryKeyConstraint('themes_level_id', 'diploma_themes_id', name=op.f('pk_diploma_themes_level')) + #) + with op.batch_alter_table('diploma_themes', schema=None) as batch_op: + #batch_op.drop_constraint(None, type_='foreignkey') + batch_op.drop_column('level_id') + + + with op.batch_alter_table('users', schema=None) as batch_op: + batch_op.add_column(sa.Column('how_to_contact', sa.String(length=512), nullable=True)) + batch_op.create_unique_constraint(batch_op.f('uq_users_email'), ['email']) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('users', schema=None) as batch_op: + batch_op.drop_constraint(batch_op.f('uq_users_email'), type_='unique') + batch_op.drop_column('how_to_contact') + + 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.add_column(sa.Column('level_id', sa.INTEGER(), nullable=True)) + batch_op.create_foreign_key(None, 'themes_level', ['level_id'], ['id']) + + op.drop_table('diploma_themes_level') + # ### end Alembic commands ### diff --git a/src/migrations/versions/e24cafdefc27_.py b/src/migrations/versions/e24cafdefc27_.py new file mode 100644 index 00000000..9b56aa30 --- /dev/null +++ b/src/migrations/versions/e24cafdefc27_.py @@ -0,0 +1,115 @@ +"""empty message + +Revision ID: e24cafdefc27 +Revises: 33ca5df0bfc2 +Create Date: 2022-10-11 14:24:08.178581 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'e24cafdefc27' +down_revision = '33ca5df0bfc2' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('deadline', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('course', sa.Integer(), nullable=False), + sa.Column('area_id', sa.Integer(), nullable=False), + sa.Column('choose_topic', sa.DateTime(), nullable=True), + sa.Column('submit_work_for_review', sa.DateTime(), nullable=True), + sa.Column('upload_reviews', sa.DateTime(), nullable=True), + sa.Column('pre_defense', sa.DateTime(), nullable=True), + sa.Column('defense', sa.DateTime(), nullable=True), + sa.ForeignKeyConstraint(['area_id'], ['areas_of_study.id'], name=op.f('fk_deadline_area_id_areas_of_study')), + sa.PrimaryKeyConstraint('id', name=op.f('pk_deadline')) + ) + op.create_table('notification_account', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('recipient_id', sa.Integer(), nullable=False), + sa.Column('content', sa.String(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=op.f('fk_notification_account_recipient_id_users')), + sa.PrimaryKeyConstraint('id', name=op.f('pk_notification_account')) + ) + op.create_table('current_thesis', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('author_id', sa.Integer(), nullable=True), + sa.Column('course', sa.Integer(), nullable=True), + sa.Column('area_id', sa.Integer(), nullable=True), + sa.Column('title', sa.String(length=512), nullable=True), + sa.Column('supervisor_id', sa.Integer(), nullable=True), + sa.Column('worktype_id', sa.Integer(), nullable=False), + sa.Column('supervisor_review_uri', sa.String(length=512), nullable=True), + sa.Column('reviewer_review_uri', sa.String(length=512), nullable=True), + sa.Column('presentation_uri', sa.String(length=512), nullable=True), + sa.Column('deleted', sa.Boolean(), nullable=True), + sa.ForeignKeyConstraint(['area_id'], ['areas_of_study.id'], name=op.f('fk_current_thesis_area_id_areas_of_study')), + sa.ForeignKeyConstraint(['author_id'], ['users.id'], name=op.f('fk_current_thesis_author_id_users')), + sa.ForeignKeyConstraint(['supervisor_id'], ['staff.id'], name=op.f('fk_current_thesis_supervisor_id_staff')), + sa.ForeignKeyConstraint(['worktype_id'], ['worktype.id'], name=op.f('fk_current_thesis_worktype_id_worktype')), + sa.PrimaryKeyConstraint('id', name=op.f('pk_current_thesis')) + ) + op.create_table('thesis_report', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('author_id', sa.Integer(), nullable=False), + sa.Column('current_thesis_id', sa.Integer(), nullable=True), + sa.Column('was_done', sa.String(length=2048), nullable=True), + sa.Column('planned_to_do', sa.String(length=2048), nullable=True), + sa.Column('time', sa.DateTime(), nullable=True), + sa.ForeignKeyConstraint(['author_id'], ['users.id'], name=op.f('fk_thesis_report_author_id_users')), + sa.ForeignKeyConstraint(['current_thesis_id'], ['current_thesis.id'], name=op.f('fk_thesis_report_current_thesis_id_current_thesis')), + sa.PrimaryKeyConstraint('id', name=op.f('pk_thesis_report')) + ) + + # ### 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.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_report') + op.drop_table('current_thesis') + op.drop_table('notification_account') + op.drop_table('deadline') + # ### end Alembic commands ### diff --git a/src/migrations/versions/e308c4667985_.py b/src/migrations/versions/e308c4667985_.py new file mode 100644 index 00000000..a240c8a0 --- /dev/null +++ b/src/migrations/versions/e308c4667985_.py @@ -0,0 +1,57 @@ +"""empty message + +Revision ID: e308c4667985 +Revises: c44ed75ba53d +Create Date: 2022-08-15 14:50:01.589016 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'e308c4667985' +down_revision = 'c44ed75ba53d' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('company', schema=None) as batch_op: + batch_op.add_column(sa.Column('status', sa.Integer(), nullable=True)) + + # ### 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('company', schema=None) as batch_op: + batch_op.drop_column('status') + + # ### end Alembic commands ###