diff --git a/migration/src/m20230322_110525_create_post.rs b/migration/src/m20230322_110525_create_post.rs index 6a91c91..821b64b 100644 --- a/migration/src/m20230322_110525_create_post.rs +++ b/migration/src/m20230322_110525_create_post.rs @@ -18,9 +18,9 @@ impl MigrationTrait for Migration { .not_null() .primary_key(), ) - .col(ColumnDef::new(Post::Description).text().not_null()) + .col(ColumnDef::new(Post::Description).text().not_null().default("")) .col(ColumnDef::new(Post::Uploader).text().not_null()) - .col(ColumnDef::new(Post::Approver).text().not_null()) + .col(ColumnDef::new(Post::Approver).text()) .col(ColumnDef::new(Post::Rating).integer().not_null()) .foreign_key( ForeignKey::create() diff --git a/src/entities/post.rs b/src/entities/post.rs index e6fff62..b18cad8 100644 --- a/src/entities/post.rs +++ b/src/entities/post.rs @@ -11,8 +11,8 @@ pub struct Model { pub description: String, #[sea_orm(column_type = "Text")] pub uploader: String, - #[sea_orm(column_type = "Text")] - pub approver: String, + #[sea_orm(column_type = "Text", nullable)] + pub approver: Option, pub rating: i32, }