Initial commit

This commit is contained in:
2025-12-31 01:10:03 +03:00
parent d7072f88fc
commit f84efea30f
2 changed files with 112 additions and 2 deletions
+57
View File
@@ -0,0 +1,57 @@
"""tests
Revision ID: 780dec53b460
Revises: 409f04b7b544
Create Date: 2025-12-31 01:09:25.135116
"""
from collections.abc import Sequence
from alembic import op
import sqlalchemy as sa
revision: str = '780dec53b460'
down_revision: str | None = '409f04b7b544'
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('tests',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('title', sa.String(length=255), nullable=False),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('for_group', sa.Integer(), nullable=True),
sa.Column('is_active', sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.create_table('questions',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('test_id', sa.Integer(), nullable=False),
sa.Column('text', sa.Text(), nullable=False),
sa.Column('position', sa.Integer(), nullable=False),
sa.Column('question_type', sa.Enum('SINGLE', 'MULTIPLE', 'INPUT', name='questiontype'), nullable=False),
sa.Column('tg_file_id', sa.String(length=255), nullable=True),
sa.ForeignKeyConstraint(['test_id'], ['tests.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('options',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('question_id', sa.Integer(), nullable=False),
sa.Column('text', sa.String(length=255), nullable=False),
sa.Column('is_correct', sa.Boolean(), nullable=False),
sa.Column('explanation', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['question_id'], ['questions.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('options')
op.drop_table('questions')
op.drop_table('tests')
# ### end Alembic commands ###