Add pk_uuid schema helper (#2329)
* Add pk_uuid schema helper * CHANGELOG --------- Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
This commit is contained in:
parent
8339dbb8df
commit
cb5520eb67
@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
* [sea-orm-macros] Call `EnumIter::get` using fully qualified syntax https://github.com/SeaQL/sea-orm/pull/2321
|
* [sea-orm-macros] Call `EnumIter::get` using fully qualified syntax https://github.com/SeaQL/sea-orm/pull/2321
|
||||||
* Construct `DatabaseConnection` directly from `sqlx::PgPool`, `sqlx::SqlitePool` and `sqlx::MySqlPool` https://github.com/SeaQL/sea-orm/pull/2348
|
* Construct `DatabaseConnection` directly from `sqlx::PgPool`, `sqlx::SqlitePool` and `sqlx::MySqlPool` https://github.com/SeaQL/sea-orm/pull/2348
|
||||||
|
* [sea-orm-migration] Add `pk_uuid` schema helper https://github.com/SeaQL/sea-orm/pull/2329
|
||||||
|
|
||||||
### Upgrades
|
### Upgrades
|
||||||
|
|
||||||
|
@ -73,6 +73,11 @@ pub fn pk_auto<T: IntoIden>(name: T) -> ColumnDef {
|
|||||||
integer(name).auto_increment().primary_key().take()
|
integer(name).auto_increment().primary_key().take()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Create a UUID primary key
|
||||||
|
pub fn pk_uuid<T: IntoIden>(name: T) -> ColumnDef {
|
||||||
|
uuid(name).primary_key().take()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn char_len<T: IntoIden>(col: T, length: u32) -> ColumnDef {
|
pub fn char_len<T: IntoIden>(col: T, length: u32) -> ColumnDef {
|
||||||
ColumnDef::new(col).char_len(length).not_null().take()
|
ColumnDef::new(col).char_len(length).not_null().take()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user