@@ -152,6 +152,10 @@ export class MysqlDriver implements Driver {
152
152
"multilinestring" ,
153
153
"multipolygon" ,
154
154
"geometrycollection" ,
155
+ // additional data types for mariadb
156
+ "uuid" ,
157
+ "inet4" ,
158
+ "inet6" ,
155
159
]
156
160
157
161
/**
@@ -331,6 +335,9 @@ export class MysqlDriver implements Driver {
331
335
update : false ,
332
336
}
333
337
338
+ /** MariaDB supports uuid type for version 10.7.0 and up */
339
+ private uuidColumnTypeSuported = false
340
+
334
341
// -------------------------------------------------------------------------
335
342
// Constructor
336
343
// -------------------------------------------------------------------------
@@ -421,6 +428,9 @@ export class MysqlDriver implements Driver {
421
428
if ( VersionUtils . isGreaterOrEqual ( dbVersion , "10.2.0" ) ) {
422
429
this . cteCapabilities . enabled = true
423
430
}
431
+ if ( VersionUtils . isGreaterOrEqual ( dbVersion , "10.7.0" ) ) {
432
+ this . uuidColumnTypeSuported = true
433
+ }
424
434
} else if ( this . options . type === "mysql" ) {
425
435
if ( VersionUtils . isGreaterOrEqual ( dbVersion , "8.0.0" ) ) {
426
436
this . cteCapabilities . enabled = true
@@ -720,7 +730,7 @@ export class MysqlDriver implements Driver {
720
730
return "blob"
721
731
} else if ( column . type === Boolean ) {
722
732
return "tinyint"
723
- } else if ( column . type === "uuid" ) {
733
+ } else if ( column . type === "uuid" && ! this . uuidColumnTypeSuported ) {
724
734
return "varchar"
725
735
} else if ( column . type === "json" && this . options . type === "mariadb" ) {
726
736
/*
@@ -825,8 +835,10 @@ export class MysqlDriver implements Driver {
825
835
826
836
/**
827
837
* fix https://github.com/typeorm/typeorm/issues/1139
838
+ * note that if the db did support uuid column type it wouldn't have been defaulted to varchar
828
839
*/
829
- if ( column . generationStrategy === "uuid" ) return "36"
840
+ if ( column . generationStrategy === "uuid" && column . type === "varchar" )
841
+ return "36"
830
842
831
843
switch ( column . type ) {
832
844
case String :
0 commit comments