Commit bcb98f4bbe570b7a1d8749688abb7e5519900e94

Authored by Ken
1 parent 7c397bbf

fix(SQL转换): 修正转postgresql时出现的类型不匹配.

Showing 1 changed file with 4 additions and 2 deletions
sql/tools/convertor.py
@@ -411,7 +411,7 @@ class PostgreSQLConvertor(Convertor): @@ -411,7 +411,7 @@ class PostgreSQLConvertor(Convertor):
411 411
412 type = type.lower() 412 type = type.lower()
413 413
414 - if type == "varchar": 414 + if type in ("varchar", "char"):
415 return f"varchar({size})" 415 return f"varchar({size})"
416 if type in ("int", "int unsigned", "int unsigned zerofill"): 416 if type in ("int", "int unsigned", "int unsigned zerofill"):
417 return "int4" 417 return "int4"
@@ -425,13 +425,15 @@ class PostgreSQLConvertor(Convertor): @@ -425,13 +425,15 @@ class PostgreSQLConvertor(Convertor):
425 return "date" 425 return "date"
426 if type == "json": 426 if type == "json":
427 return "jsonb" 427 return "jsonb"
  428 + if type == "time":
  429 + return "time"
428 if type == "double": 430 if type == "double":
429 return "double precision" 431 return "double precision"
430 if type == "timestamp": 432 if type == "timestamp":
431 return f"timestamp({size})" if size else "timestamp" 433 return f"timestamp({size})" if size else "timestamp"
432 if type == "bit": 434 if type == "bit":
433 return "bool" 435 return "bool"
434 - if type in ("text", "longtext"): 436 + if type in ("text", "longtext", "mediumtext"):
435 return "text" 437 return "text"
436 if type in ("blob", "mediumblob", "longblob"): 438 if type in ("blob", "mediumblob", "longblob"):
437 return "bytea" 439 return "bytea"