Initial commit

This commit is contained in:
2026-01-01 03:12:21 +03:00
parent 59a4baabd4
commit bf04bde890
8 changed files with 149 additions and 11 deletions
+59
View File
@@ -0,0 +1,59 @@
"""tests
Revision ID: 59dd00dc1990
Revises: 409f04b7b544
Create Date: 2026-01-01 03:02:33.134535
"""
from collections.abc import Sequence
from alembic import op
import sqlalchemy as sa
revision: str = '59dd00dc1990'
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.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('now()'), 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 ###