316 lines
13 KiB
Python
316 lines
13 KiB
Python
"""empty message
|
|
|
|
Revision ID: 5f2f440d05e2
|
|
Revises:
|
|
Create Date: 2023-01-15 23:52:36.927007
|
|
|
|
"""
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "5f2f440d05e2"
|
|
down_revision = None
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table(
|
|
"year_groups",
|
|
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
|
|
sa.Column("name", sa.String(length=50), nullable=False),
|
|
sa.Column("mode", sa.String(length=1), nullable=False),
|
|
sa.Column("created_at", sa.DateTime(), nullable=False),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_table(
|
|
"examination_schedules",
|
|
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
|
|
sa.Column("title", sa.String(length=100), nullable=False),
|
|
sa.Column("duration_time", sa.Integer(), nullable=False),
|
|
sa.Column("open_enrollments", sa.String(length=1), nullable=False),
|
|
sa.Column("start_date", sa.DateTime(), nullable=False),
|
|
sa.Column("end_date", sa.DateTime(), nullable=False),
|
|
sa.Column("year_group_id", sa.Integer(), nullable=False),
|
|
sa.ForeignKeyConstraint(
|
|
["year_group_id"],
|
|
["year_groups.id"],
|
|
),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
sa.UniqueConstraint("title"),
|
|
)
|
|
op.create_table(
|
|
"project_supervisors",
|
|
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
|
|
sa.Column("first_name", sa.String(length=255), nullable=False),
|
|
sa.Column("last_name", sa.String(length=255), nullable=False),
|
|
sa.Column("email", sa.String(length=120), nullable=False),
|
|
sa.Column("limit_group", sa.Integer(), nullable=False),
|
|
sa.Column("is_coordinator", sa.Boolean(), nullable=False),
|
|
sa.Column("year_group_id", sa.Integer(), nullable=True),
|
|
sa.ForeignKeyConstraint(
|
|
["year_group_id"],
|
|
["year_groups.id"],
|
|
),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_index(
|
|
op.f("ix_project_supervisors_email"),
|
|
"project_supervisors",
|
|
["email"],
|
|
unique=False,
|
|
)
|
|
op.create_index(
|
|
op.f("ix_project_supervisors_first_name"),
|
|
"project_supervisors",
|
|
["first_name"],
|
|
unique=False,
|
|
)
|
|
op.create_index(
|
|
op.f("ix_project_supervisors_last_name"),
|
|
"project_supervisors",
|
|
["last_name"],
|
|
unique=False,
|
|
)
|
|
op.create_table(
|
|
"students",
|
|
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
|
|
sa.Column("first_name", sa.String(length=255), nullable=False),
|
|
sa.Column("last_name", sa.String(length=255), nullable=False),
|
|
sa.Column("email", sa.String(length=120), nullable=False),
|
|
sa.Column("index", sa.Integer(), nullable=False),
|
|
sa.Column("year_group_id", sa.Integer(), nullable=True),
|
|
sa.ForeignKeyConstraint(
|
|
["year_group_id"],
|
|
["year_groups.id"],
|
|
),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_index(op.f("ix_students_email"), "students", ["email"], unique=False)
|
|
op.create_index(
|
|
op.f("ix_students_first_name"), "students", ["first_name"], unique=False
|
|
)
|
|
op.create_index(
|
|
op.f("ix_students_last_name"), "students", ["last_name"], unique=False
|
|
)
|
|
op.create_table(
|
|
"groups",
|
|
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
|
|
sa.Column("name", sa.String(length=60), nullable=False),
|
|
sa.Column("cdyd_kod", sa.String(length=60), nullable=True),
|
|
sa.Column("prz_kod", sa.String(length=60), nullable=True),
|
|
sa.Column("tzaj_kod", sa.String(length=60), nullable=True),
|
|
sa.Column("project_supervisor_id", sa.Integer(), nullable=True),
|
|
sa.Column("year_group_id", sa.Integer(), nullable=True),
|
|
sa.Column("points_for_first_term", sa.Float(), nullable=False),
|
|
sa.Column("points_for_second_term", sa.Float(), nullable=False),
|
|
sa.Column("grade_for_first_term", sa.Float(), nullable=False),
|
|
sa.Column("grade_for_second_term", sa.Float(), nullable=False),
|
|
sa.ForeignKeyConstraint(
|
|
["project_supervisor_id"],
|
|
["project_supervisors.id"],
|
|
),
|
|
sa.ForeignKeyConstraint(
|
|
["year_group_id"],
|
|
["year_groups.id"],
|
|
),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_table(
|
|
"temporary_availabilities",
|
|
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
|
|
sa.Column("start_date", sa.DateTime(), nullable=False),
|
|
sa.Column("end_date", sa.DateTime(), nullable=False),
|
|
sa.Column("examination_schedule_id", sa.Integer(), nullable=False),
|
|
sa.Column("project_supervisor_id", sa.Integer(), nullable=False),
|
|
sa.ForeignKeyConstraint(
|
|
["examination_schedule_id"],
|
|
["examination_schedules.id"],
|
|
),
|
|
sa.ForeignKeyConstraint(
|
|
["project_supervisor_id"],
|
|
["project_supervisors.id"],
|
|
),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_table(
|
|
"project_grade_sheets",
|
|
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
|
|
sa.Column("group_id", sa.Integer(), nullable=True),
|
|
sa.Column("presentation_required_content_1", sa.Integer(), nullable=True),
|
|
sa.Column("presentation_required_content_2", sa.Integer(), nullable=True),
|
|
sa.Column("presentation_was_compatible_1", sa.Integer(), nullable=True),
|
|
sa.Column("presentation_was_compatible_2", sa.Integer(), nullable=True),
|
|
sa.Column("presentation_showing_1", sa.Integer(), nullable=True),
|
|
sa.Column("presentation_showing_2", sa.Integer(), nullable=True),
|
|
sa.Column(
|
|
"presentation_answers_to_questions_from_committee_1",
|
|
sa.Integer(),
|
|
nullable=True,
|
|
),
|
|
sa.Column(
|
|
"presentation_answers_to_questions_from_committee_2",
|
|
sa.Integer(),
|
|
nullable=True,
|
|
),
|
|
sa.Column("documentation_project_vision_1", sa.Integer(), nullable=True),
|
|
sa.Column("documentation_project_vision_2", sa.Integer(), nullable=True),
|
|
sa.Column("documentation_requirements_1", sa.Integer(), nullable=True),
|
|
sa.Column("documentation_requirements_2", sa.Integer(), nullable=True),
|
|
sa.Column("documentation_for_clients_1", sa.Integer(), nullable=True),
|
|
sa.Column("documentation_for_clients_2", sa.Integer(), nullable=True),
|
|
sa.Column("documentation_for_developers_1", sa.Integer(), nullable=True),
|
|
sa.Column("documentation_for_developers_2", sa.Integer(), nullable=True),
|
|
sa.Column("documentation_license_1", sa.Integer(), nullable=True),
|
|
sa.Column("documentation_license_2", sa.Integer(), nullable=True),
|
|
sa.Column("group_work_regularity_1", sa.Integer(), nullable=True),
|
|
sa.Column("group_work_regularity_2", sa.Integer(), nullable=True),
|
|
sa.Column("group_work_division_of_work_1", sa.Integer(), nullable=True),
|
|
sa.Column("group_work_division_of_work_2", sa.Integer(), nullable=True),
|
|
sa.Column("group_work_contact_with_client_1", sa.Integer(), nullable=True),
|
|
sa.Column("group_work_contact_with_client_2", sa.Integer(), nullable=True),
|
|
sa.Column("group_work_management_of_risk_1", sa.Integer(), nullable=True),
|
|
sa.Column("group_work_management_of_risk_2", sa.Integer(), nullable=True),
|
|
sa.Column("group_work_work_methodology_1", sa.Integer(), nullable=True),
|
|
sa.Column("group_work_work_methodology_2", sa.Integer(), nullable=True),
|
|
sa.Column(
|
|
"group_work_management_of_source_code_1", sa.Integer(), nullable=True
|
|
),
|
|
sa.Column(
|
|
"group_work_management_of_source_code_2", sa.Integer(), nullable=True
|
|
),
|
|
sa.Column("group_work_devops_1", sa.Integer(), nullable=True),
|
|
sa.Column("group_work_devops_2", sa.Integer(), nullable=True),
|
|
sa.Column(
|
|
"products_project_complexity_of_product_1", sa.Integer(), nullable=True
|
|
),
|
|
sa.Column(
|
|
"products_project_complexity_of_product_2", sa.Integer(), nullable=True
|
|
),
|
|
sa.Column(
|
|
"products_project_access_to_application_1", sa.Integer(), nullable=True
|
|
),
|
|
sa.Column(
|
|
"products_project_access_to_application_2", sa.Integer(), nullable=True
|
|
),
|
|
sa.Column("products_project_security_issues_1", sa.Integer(), nullable=True),
|
|
sa.Column("products_project_security_issues_2", sa.Integer(), nullable=True),
|
|
sa.Column(
|
|
"products_project_access_to_test_application_1", sa.Integer(), nullable=True
|
|
),
|
|
sa.Column(
|
|
"products_project_access_to_test_application_2", sa.Integer(), nullable=True
|
|
),
|
|
sa.Column(
|
|
"products_project_acceptance_criteria_1", sa.Integer(), nullable=True
|
|
),
|
|
sa.Column(
|
|
"products_project_acceptance_criteria_2", sa.Integer(), nullable=True
|
|
),
|
|
sa.Column(
|
|
"products_project_expected_functionality_1", sa.Integer(), nullable=True
|
|
),
|
|
sa.Column(
|
|
"products_project_expected_functionality_2", sa.Integer(), nullable=True
|
|
),
|
|
sa.Column("products_project_promises_well_1", sa.Integer(), nullable=True),
|
|
sa.Column("products_project_promises_well_2", sa.Integer(), nullable=True),
|
|
sa.Column(
|
|
"products_project_has_been_implemented_1", sa.Integer(), nullable=True
|
|
),
|
|
sa.Column(
|
|
"products_project_has_been_implemented_2", sa.Integer(), nullable=True
|
|
),
|
|
sa.Column("products_project_is_useful_1", sa.Integer(), nullable=True),
|
|
sa.Column("products_project_is_useful_2", sa.Integer(), nullable=True),
|
|
sa.Column("products_project_prototype_1", sa.Integer(), nullable=True),
|
|
sa.Column("products_project_prototype_2", sa.Integer(), nullable=True),
|
|
sa.Column("products_project_tests_1", sa.Integer(), nullable=True),
|
|
sa.Column("products_project_tests_2", sa.Integer(), nullable=True),
|
|
sa.Column("products_project_technology_1", sa.Integer(), nullable=True),
|
|
sa.Column("products_project_technology_2", sa.Integer(), nullable=True),
|
|
sa.ForeignKeyConstraint(
|
|
["group_id"],
|
|
["groups.id"],
|
|
),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_table(
|
|
"students_groups",
|
|
sa.Column("group_id", sa.Integer(), nullable=False),
|
|
sa.Column("student_id", sa.Integer(), nullable=False),
|
|
sa.ForeignKeyConstraint(
|
|
["group_id"],
|
|
["groups.id"],
|
|
),
|
|
sa.ForeignKeyConstraint(
|
|
["student_id"],
|
|
["students.id"],
|
|
),
|
|
)
|
|
op.create_table(
|
|
"term_of_defences",
|
|
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
|
|
sa.Column("start_date", sa.DateTime(), nullable=False),
|
|
sa.Column("end_date", sa.DateTime(), nullable=False),
|
|
sa.Column("examination_schedule_id", sa.Integer(), nullable=True),
|
|
sa.Column("group_id", sa.Integer(), nullable=True),
|
|
sa.Column("chairman_of_committee", sa.Integer(), nullable=True),
|
|
sa.ForeignKeyConstraint(
|
|
["chairman_of_committee"],
|
|
["project_supervisors.id"],
|
|
),
|
|
sa.ForeignKeyConstraint(
|
|
["examination_schedule_id"],
|
|
["examination_schedules.id"],
|
|
),
|
|
sa.ForeignKeyConstraint(
|
|
["group_id"],
|
|
["groups.id"],
|
|
),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_table(
|
|
"committees",
|
|
sa.Column("term_of_defence_id", sa.Integer(), nullable=True),
|
|
sa.Column("project_supervisor_id", sa.Integer(), nullable=True),
|
|
sa.ForeignKeyConstraint(
|
|
["project_supervisor_id"],
|
|
["project_supervisors.id"],
|
|
),
|
|
sa.ForeignKeyConstraint(
|
|
["term_of_defence_id"],
|
|
["term_of_defences.id"],
|
|
),
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table("committees")
|
|
op.drop_table("term_of_defences")
|
|
op.drop_table("students_groups")
|
|
op.drop_table("project_grade_sheets")
|
|
op.drop_table("temporary_availabilities")
|
|
op.drop_table("groups")
|
|
op.drop_index(op.f("ix_students_last_name"), table_name="students")
|
|
op.drop_index(op.f("ix_students_first_name"), table_name="students")
|
|
op.drop_index(op.f("ix_students_email"), table_name="students")
|
|
op.drop_table("students")
|
|
op.drop_index(
|
|
op.f("ix_project_supervisors_last_name"), table_name="project_supervisors"
|
|
)
|
|
op.drop_index(
|
|
op.f("ix_project_supervisors_first_name"), table_name="project_supervisors"
|
|
)
|
|
op.drop_index(
|
|
op.f("ix_project_supervisors_email"), table_name="project_supervisors"
|
|
)
|
|
op.drop_table("project_supervisors")
|
|
op.drop_table("examination_schedules")
|
|
op.drop_table("year_groups")
|
|
# ### end Alembic commands ###
|