1- #[ cfg( feature = "postgres" ) ] use crate :: constants:: postgresql_type;
2- #[ cfg( feature = "mssql" ) ] use crate :: constants:: sqlserver_type;
1+ #[ cfg( feature = "postgres" ) ]
2+ use crate :: constants:: postgresql_type;
3+ #[ cfg( feature = "mssql" ) ]
4+ use crate :: constants:: sqlserver_type;
35use crate :: constants:: { regex_patterns, rust_type} ;
46
5-
67use canyon_entities:: register_types:: CanyonRegisterEntityField ;
78use regex:: Regex ;
89
@@ -59,9 +60,7 @@ pub fn to_sqlserver_syntax(field: &CanyonRegisterEntityField) -> String {
5960 let rust_type_clean = field. field_type . replace ( ' ' , "" ) ;
6061
6162 match rust_type_clean. as_str ( ) {
62- rust_type:: I8 | rust_type:: U8 => {
63- String :: from ( & format ! ( "{} NOT NULL" , sqlserver_type:: INT ) )
64- }
63+ rust_type:: I8 | rust_type:: U8 => String :: from ( & format ! ( "{} NOT NULL" , sqlserver_type:: INT ) ) ,
6564 rust_type:: OPT_I8 | rust_type:: OPT_U8 => String :: from ( sqlserver_type:: INT ) ,
6665
6766 rust_type:: I16 | rust_type:: U16 => {
@@ -131,12 +130,8 @@ pub fn to_postgres_alter_syntax(field: &CanyonRegisterEntityField) -> String {
131130 }
132131 rust_type:: STRING | rust_type:: OPT_STRING => String :: from ( postgresql_type:: TEXT ) ,
133132 rust_type:: BOOL | rust_type:: OPT_BOOL => String :: from ( postgresql_type:: BOOLEAN ) ,
134- rust_type:: NAIVE_DATE | rust_type:: OPT_NAIVE_DATE => {
135- String :: from ( postgresql_type:: DATE )
136- }
137- rust_type:: NAIVE_TIME | rust_type:: OPT_NAIVE_TIME => {
138- String :: from ( postgresql_type:: TIME )
139- }
133+ rust_type:: NAIVE_DATE | rust_type:: OPT_NAIVE_DATE => String :: from ( postgresql_type:: DATE ) ,
134+ rust_type:: NAIVE_TIME | rust_type:: OPT_NAIVE_TIME => String :: from ( postgresql_type:: TIME ) ,
140135 rust_type:: NAIVE_DATE_TIME | rust_type:: OPT_NAIVE_DATE_TIME => {
141136 String :: from ( postgresql_type:: DATETIME )
142137 }
@@ -181,4 +176,4 @@ pub fn to_sqlserver_alter_syntax(field: &CanyonRegisterEntityField) -> String {
181176 }
182177 & _ => todo ! ( "Not supported datatype for this migrations version" ) ,
183178 }
184- }
179+ }
0 commit comments