From b3cd22d080efb933ecac0c619b716e6bc13a9b1d Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Fri, 4 Feb 2022 15:28:08 +0800 Subject: [PATCH] `ColumnDef` with default value (SeaQL/sea-orm#489) --- SeaORM/docs/03-generate-entity/02-entity-structure.md | 4 ++-- .../docs/03-generate-entity/03-expanded-entity-structure.md | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/SeaORM/docs/03-generate-entity/02-entity-structure.md b/SeaORM/docs/03-generate-entity/02-entity-structure.md index 0c8f307df2d..2cd1064d7ae 100644 --- a/SeaORM/docs/03-generate-entity/02-entity-structure.md +++ b/SeaORM/docs/03-generate-entity/02-entity-structure.md @@ -85,12 +85,12 @@ pub name: String ### Additional Properties -You can add additional properties `unique`, `indexed` and `nullable` to a column. +You can add additional properties `default_value`, `unique`, `indexed` and `nullable` to a column. If you specified a custom `column_type` for an optional attribute, you must also specify `nullable`. ```rust -#[sea_orm(column_type = "Text", unique, indexed, nullable)] +#[sea_orm(column_type = "Text", default_value = "Sam", unique, indexed, nullable)] pub name: Option ``` diff --git a/SeaORM/docs/03-generate-entity/03-expanded-entity-structure.md b/SeaORM/docs/03-generate-entity/03-expanded-entity-structure.md index 3d5160d87d2..fbd4d75c437 100644 --- a/SeaORM/docs/03-generate-entity/03-expanded-entity-structure.md +++ b/SeaORM/docs/03-generate-entity/03-expanded-entity-structure.md @@ -63,12 +63,13 @@ To specify the datatype of each column, the [`ColumnType`](https://docs.rs/sea-o ### Additional properties +- Default Value - Unique - Indexed - Nullable ```rust -ColumnType::String(None).def().unique().indexed().nullable() +ColumnType::String(None).def().default_value("Sam").unique().indexed().nullable() ``` ## Primary Key