From ae3c2ad6edb94c57650aac908d6027dea4fa3c17 Mon Sep 17 00:00:00 2001
From: philipcheung <zerophilip2013hk@gmail.com>
Date: Wed, 22 Jan 2025 19:26:07 +0800
Subject: [PATCH] updated index

---
 .../3d3e62ca614e_index_can_be_null.py         | 29 +++++++++++++++++++
 backend/app/models.py                         |  4 +--
 2 files changed, 31 insertions(+), 2 deletions(-)
 create mode 100644 backend/app/alembic/versions/3d3e62ca614e_index_can_be_null.py

diff --git a/backend/app/alembic/versions/3d3e62ca614e_index_can_be_null.py b/backend/app/alembic/versions/3d3e62ca614e_index_can_be_null.py
new file mode 100644
index 0000000..356f097
--- /dev/null
+++ b/backend/app/alembic/versions/3d3e62ca614e_index_can_be_null.py
@@ -0,0 +1,29 @@
+"""index can be null
+
+Revision ID: 3d3e62ca614e
+Revises: 0fae792dfdd0
+Create Date: 2025-01-22 11:25:55.056526
+
+"""
+from alembic import op
+import sqlalchemy as sa
+import sqlmodel.sql.sqltypes
+
+
+# revision identifiers, used by Alembic.
+revision = '3d3e62ca614e'
+down_revision = '0fae792dfdd0'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.add_column('course', sa.Column('index', sa.Integer(), nullable=True))
+    # ### end Alembic commands ###
+
+
+def downgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.drop_column('course', 'index')
+    # ### end Alembic commands ###
diff --git a/backend/app/models.py b/backend/app/models.py
index d6e34ec..f2fb85e 100644
--- a/backend/app/models.py
+++ b/backend/app/models.py
@@ -236,7 +236,7 @@ class CourseBase(SQLModel):
     title: str = Field(max_length=255)
     sort_description: str = Field(max_length=32768)
     long_description: str = Field(max_length=32768)
-    #index: int = Field(default=10)
+    index: int | None = Field(default=10)
     information: str = Field(max_length=32768)
     contant: str = Field(max_length=32768)
     remark: str = Field(max_length=32768)
@@ -265,7 +265,7 @@ class Course(CourseBase, table=True):
 class CoursePublic(CourseBase):
     id: uuid.UUID
     title: str
-    #index: int
+    index: int
     images: list["Image"]
     info_images: list["Info_Image"]
     schedule: list["Schedule"]