diff --git a/classquiz/db/models.py b/classquiz/db/models.py index 496a46c..3074abe 100644 --- a/classquiz/db/models.py +++ b/classquiz/db/models.py @@ -127,8 +127,8 @@ class QuizInput(BaseModel): class Quiz(ormar.Model): id: uuid.UUID = ormar.UUID(primary_key=True, default=uuid.uuid4(), nullable=False, unique=True) public: bool = ormar.Boolean(default=False) - title: str = ormar.String(max_length=100) - description: str = ormar.String(max_length=300, nullable=True) + title: str = ormar.Text() + description: str = ormar.Text(nullable=True) created_at: datetime = ormar.DateTime(default=datetime.now()) updated_at: datetime = ormar.DateTime(default=datetime.now()) user_id: uuid.UUID = ormar.ForeignKey(User) diff --git a/migrations/versions/b2acaede5c2f_made_title_and_description_be_text_not_.py b/migrations/versions/b2acaede5c2f_made_title_and_description_be_text_not_.py new file mode 100644 index 0000000..53de77d --- /dev/null +++ b/migrations/versions/b2acaede5c2f_made_title_and_description_be_text_not_.py @@ -0,0 +1,27 @@ +"""Made title and description be text not string + +Revision ID: b2acaede5c2f +Revises: 400f8ed06c48 +Create Date: 2022-12-17 11:31:42.036454 + +""" +from alembic import op +import sqlalchemy as sa +import ormar + + +# revision identifiers, used by Alembic. +revision = "b2acaede5c2f" +down_revision = "400f8ed06c48" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + op.alter_column("quiz", "title", type_=sa.Text) + op.alter_column("quiz", "description", type_=sa.Text) + + +def downgrade() -> None: + op.alter_column("quiz", "title", type_=sa.String) + op.alter_column("quiz", "description", type_=sa.String)