From 13f6ef8443c37a0e27d7b2ee12980bf8f183a566 Mon Sep 17 00:00:00 2001 From: Evie Viau Date: Wed, 22 Mar 2023 04:40:29 -0700 Subject: [PATCH] Add default blank desc and make approver optional --- migration/src/m20230322_110525_create_post.rs | 4 ++-- src/entities/post.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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, }