mirror of
https://github.com/dimitri/pgloader.git
synced 2025-08-09 15:56:58 +02:00
Fix user defined rules to cast ENUM to Text.
The MySQL enum are casted to PostgreSQL enum types just fine, but sometimes that's not what the user wants. In case when we have a CAST rule for an ENUM column, recognize the fact and respect user choice. Fixes #608.
This commit is contained in:
parent
049a1199c2
commit
981b801ce7
@ -190,12 +190,22 @@
|
|||||||
dtype
|
dtype
|
||||||
ctype
|
ctype
|
||||||
nil)))
|
nil)))
|
||||||
|
;;
|
||||||
|
;; We might have user-defined cast rules e.g. converting an ENUM
|
||||||
|
;; to text, in which case we have nothing to do here. We set a
|
||||||
|
;; PostgreSQL enum only when the casting rules already generated
|
||||||
|
;; the target type name.
|
||||||
|
;;
|
||||||
|
;; FIXME: why call enum-or-set-name twice, once from
|
||||||
|
;; *mysql-default-cast-rules* and once here explicitely?
|
||||||
|
;;
|
||||||
|
(when (string= sqltype-name (column-type-name pgcol))
|
||||||
(setf (column-type-name pgcol)
|
(setf (column-type-name pgcol)
|
||||||
(make-sqltype :name sqltype-name
|
(make-sqltype :name sqltype-name
|
||||||
:type (intern (string-upcase dtype)
|
:type (intern (string-upcase dtype)
|
||||||
(find-package "KEYWORD"))
|
(find-package "KEYWORD"))
|
||||||
:source-def ctype
|
:source-def ctype
|
||||||
:extra (explode-mysql-enum ctype)))))
|
:extra (explode-mysql-enum ctype))))))
|
||||||
|
|
||||||
;; extra triggers
|
;; extra triggers
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user