Skip to content

Commit 4431ee6

Browse files
committed
[SeaORM] Edit
1 parent cfa7b77 commit 4431ee6

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

SeaORM/docs/04-generate-entity/04-enumeration.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Table::create()
113113

114114
If you are using Postgres, the enum has to be created in a separate `Type` statement in a migration, you can create it with:
115115

116-
#### 1. Custom TYPE statement
116+
#### 1. `TYPE` statement
117117

118118
[Full example](https://github.com/SeaQL/sea-orm/blob/master/sea-orm-migration/tests/common/migration/m20220118_000004_create_tea_enum.rs).
119119

@@ -134,7 +134,8 @@ manager
134134
#### 2. `create_enum_from_active_enum`
135135
This method will provide an interface for adding the type to the database, using the type for table columns, and adding values of this type to rows when seeding data.
136136

137-
##### 1. Define a native database `ActiveEnum`
137+
1. Define an `ActiveEnum`
138+
138139
```rust
139140
#[derive(EnumIter, DeriveActiveEnum)]
140141
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "tea_type")]
@@ -146,11 +147,12 @@ pub enum TeaType {
146147
}
147148
```
148149

149-
##### 2. Create the type in the database:
150-
```rust
151-
// we can do this in migration:
150+
2. Create the type in the database
152151

152+
```rust
153153
use sea_orm::{Schema, DbBackend};
154+
155+
// in a migration:
154156
let schema = Schema::new(DbBackend::Postgres);
155157

156158
manager
@@ -161,19 +163,21 @@ manager
161163
.await?;
162164
```
163165

164-
##### 3. Use the type as a table column type when creating a table:
166+
3. Use the type as a table column type when creating a table
167+
165168
```rust diff
166-
// in a migration
169+
// in a migration:
167170

168171
manager::create()
169172
.table(Tea::Table)
170173
.if_not_exists()
171174
.col(Column::new(Tea::Type).custom(TeaType::name())) // use the type for a table column
172175
// ... more columns
173176
```
174-
* see also [Schema Creation Methods - Create Table](https://www.sea-ql.org/SeaORM/docs/migration/writing-migration/#schema-creation-methods)
177+
> see also [Schema Creation Methods - Create Table](https://www.sea-ql.org/SeaORM/docs/migration/writing-migration/#schema-creation-methods)
178+
179+
4. Use the type when populating the database
175180

176-
##### 4. Use the type when populating the database:
177181
```rust
178182
// in a migration
179183

@@ -186,7 +190,7 @@ let insert = Query::insert()
186190
manager.exec_stmt(insert).await?;
187191
// ...
188192
```
189-
* see also [Seeding Data - with sea_query statement](https://www.sea-ql.org/SeaORM/docs/migration/seeding-data/#:~:text=write%20SeaQuery%20statement%20to%20seed%20the%20table)
193+
> see also [Seeding Data - with sea_query statement](https://www.sea-ql.org/SeaORM/docs/migration/seeding-data/#:~:text=write%20SeaQuery%20statement%20to%20seed%20the%20table)
190194
191195
## Implementations
192196

SeaORM/docusaurus.config.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ module.exports = {
118118
label: 'Twitter',
119119
to: 'https://twitter.com/sea_ql',
120120
},
121-
{
122-
label: 'GSoC',
123-
to: 'https://summerofcode.withgoogle.com/programs/2022/organizations/seaql',
124-
},
125121
],
126122
},
127123
{

0 commit comments

Comments
 (0)