File tree Expand file tree Collapse file tree 4 files changed +10
-0
lines changed Expand file tree Collapse file tree 4 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ impl TableBuilder for MysqlQueryBuilder {
82
82
ColumnType :: Json => "json" . into( ) ,
83
83
ColumnType :: JsonBinary => "json" . into( ) ,
84
84
ColumnType :: Custom ( iden) => iden. to_string( ) ,
85
+ ColumnType :: Uuid => format!( "binary(16)" ) ,
85
86
}
86
87
)
87
88
. unwrap ( )
Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ impl TableBuilder for PostgresQueryBuilder {
82
82
ColumnType :: Json => "json" . into( ) ,
83
83
ColumnType :: JsonBinary => "jsonb" . into( ) ,
84
84
ColumnType :: Custom ( iden) => iden. to_string( ) ,
85
+ ColumnType :: Uuid => "uuid" . into( ) ,
85
86
}
86
87
)
87
88
. unwrap ( )
Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ impl TableBuilder for SqliteQueryBuilder {
102
102
ColumnType :: Json => "text" . into( ) ,
103
103
ColumnType :: JsonBinary => "text" . into( ) ,
104
104
ColumnType :: Custom ( iden) => iden. to_string( ) ,
105
+ ColumnType :: Uuid => "text(36)" . into( ) ,
105
106
}
106
107
)
107
108
. unwrap ( )
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ pub enum ColumnType {
32
32
Json ,
33
33
JsonBinary ,
34
34
Custom ( DynIden ) ,
35
+ Uuid ,
35
36
}
36
37
37
38
/// All column specification keywords
@@ -321,4 +322,10 @@ impl ColumnDef {
321
322
pub fn get_column_spec ( & self ) -> & Vec < ColumnSpec > {
322
323
self . spec . as_ref ( )
323
324
}
325
+
326
+ /// Set column type as uuid
327
+ pub fn uuid ( mut self ) -> Self {
328
+ self . types = Some ( ColumnType :: Uuid ) ;
329
+ self
330
+ }
324
331
}
You can’t perform that action at this time.
0 commit comments