-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cbcb7d7
commit 032f9e3
Showing
4 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...rations/versions/2023_11_19_1035-43a526a12009_добавляет_связь_между_задачей_и_ответами.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""добавляет связь между задачей и ответами | ||
Revision ID: 43a526a12009 | ||
Revises: 5bbffa09568b | ||
Create Date: 2023-11-19 10:35:20.123826 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = '43a526a12009' | ||
down_revision: Union[str, None] = '5bbffa09568b' | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('questions', sa.Column('task_id', sa.UUID(), nullable=True)) | ||
op.create_foreign_key(None, 'questions', 'tasks', ['task_id'], ['id']) | ||
op.add_column('tasks', sa.Column('level_id', sa.UUID(), nullable=True)) | ||
op.create_foreign_key(None, 'tasks', 'levels', ['level_id'], ['id']) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_constraint(None, 'tasks', type_='foreignkey') | ||
op.drop_column('tasks', 'level_id') | ||
op.drop_constraint(None, 'questions', type_='foreignkey') | ||
op.drop_column('questions', 'task_id') | ||
# ### end Alembic commands ### |
30 changes: 30 additions & 0 deletions
30
...nd/migrations/versions/2023_11_19_1037-e21d5fb84a66_добавляет_связь_между_вопросами_и_.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""добавляет связь между вопросами и ответами | ||
Revision ID: e21d5fb84a66 | ||
Revises: 43a526a12009 | ||
Create Date: 2023-11-19 10:37:12.398132 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = 'e21d5fb84a66' | ||
down_revision: Union[str, None] = '43a526a12009' | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_foreign_key(None, 'answers', 'questions', ['question_id'], ['id']) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_constraint(None, 'answers', type_='foreignkey') | ||
# ### end Alembic commands ### |
36 changes: 36 additions & 0 deletions
36
...grations/versions/2023_11_19_1048-e8496d8a36fc_временно_удаляет_таблицу_с_видео_теории.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""временно удаляет таблицу с видео теории | ||
Revision ID: e8496d8a36fc | ||
Revises: e21d5fb84a66 | ||
Create Date: 2023-11-19 10:48:35.457329 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = 'e8496d8a36fc' | ||
down_revision: Union[str, None] = 'e21d5fb84a66' | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table('theory_videos') | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('theory_videos', | ||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False), | ||
sa.Column('theory_id', sa.UUID(), autoincrement=False, nullable=False), | ||
sa.Column('url', sa.TEXT(), autoincrement=False, nullable=False), | ||
sa.ForeignKeyConstraint(['theory_id'], ['theory_blocks.id'], name='theory_videos_theory_id_fkey'), | ||
sa.PrimaryKeyConstraint('id', name='theory_videos_pkey') | ||
) | ||
# ### end Alembic commands ### |
40 changes: 40 additions & 0 deletions
40
...rations/versions/2023_11_19_2146-4e3cf7a2acb2_модуль_и_уровни_обязательно_привязаны_к_.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"""модуль и уровни обязательно привязаны к родителю | ||
Revision ID: 4e3cf7a2acb2 | ||
Revises: e8496d8a36fc | ||
Create Date: 2023-11-19 21:46:34.041826 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = '4e3cf7a2acb2' | ||
down_revision: Union[str, None] = 'e8496d8a36fc' | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.alter_column('levels', 'module_id', | ||
existing_type=sa.UUID(), | ||
nullable=False) | ||
op.alter_column('modules', 'map_id', | ||
existing_type=sa.UUID(), | ||
nullable=False) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.alter_column('modules', 'map_id', | ||
existing_type=sa.UUID(), | ||
nullable=True) | ||
op.alter_column('levels', 'module_id', | ||
existing_type=sa.UUID(), | ||
nullable=True) | ||
# ### end Alembic commands ### |