Commit 6ae447f768b2056606a924596b71af7135fa8e32

Authored by 芋道源码
Committed by GitHub
2 parents 2f5c9fa1 bcb98f4b

Merge pull request #1289 from java-acc/fix-sqltool-convert-to-pgsql-type

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 411  
412 412 type = type.lower()
413 413  
414   - if type == "varchar":
  414 + if type in ("varchar", "char"):
415 415 return f"varchar({size})"
416 416 if type in ("int", "int unsigned", "int unsigned zerofill"):
417 417 return "int4"
... ... @@ -425,13 +425,15 @@ class PostgreSQLConvertor(Convertor):
425 425 return "date"
426 426 if type == "json":
427 427 return "jsonb"
  428 + if type == "time":
  429 + return "time"
428 430 if type == "double":
429 431 return "double precision"
430 432 if type == "timestamp":
431 433 return f"timestamp({size})" if size else "timestamp"
432 434 if type == "bit":
433 435 return "bool"
434   - if type in ("text", "longtext"):
  436 + if type in ("text", "longtext", "mediumtext"):
435 437 return "text"
436 438 if type in ("blob", "mediumblob", "longblob"):
437 439 return "bytea"
... ...