Skip to content

Commit

Permalink
ColumnDef with default value (SeaQL/sea-orm#489)
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 committed Feb 4, 2022
1 parent 409db0b commit b3cd22d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions SeaORM/docs/03-generate-entity/02-entity-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b3cd22d

Please sign in to comment.