mirror of
https://github.com/dimitri/pgloader.git
synced 2025-08-06 22:37:02 +02:00
Finish implementation of CAST rules for PostgreSQL source databases.
Add a link to the table from the internal catalogs for columns so that we can match table-source-name in cast rules when migrating from PostgreSQL.
This commit is contained in:
parent
aa8ae159e2
commit
3f2f10eef1
@ -185,7 +185,8 @@
|
||||
:do
|
||||
(let* ((schema (maybe-add-schema catalog schema-name))
|
||||
(table (maybe-add-table schema table-name :oid table-oid))
|
||||
(field (make-column :name name
|
||||
(field (make-column :table table
|
||||
:name name
|
||||
:type-name type
|
||||
:type-mod typmod
|
||||
:nullable (not notnull)
|
||||
|
@ -26,7 +26,8 @@
|
||||
(defmethod cast ((field column) &key &allow-other-keys)
|
||||
"Return the PostgreSQL type definition from the given PostgreSQL column
|
||||
definition"
|
||||
(with-slots (pgloader.catalog::name
|
||||
(with-slots (pgloader.catalog::table
|
||||
pgloader.catalog::name
|
||||
pgloader.catalog::type-name
|
||||
pgloader.catalog::type-mod
|
||||
pgloader.catalog::nullable
|
||||
@ -40,7 +41,7 @@
|
||||
(when (and (stringp (column-default field))
|
||||
(search "identity" (column-default field)))
|
||||
:auto-increment)))
|
||||
(pgcol (apply-casting-rules nil
|
||||
(pgcol (apply-casting-rules (table-source-name pgloader.catalog::table)
|
||||
pgloader.catalog::name
|
||||
pgloader.catalog::type-name
|
||||
ctype
|
||||
|
@ -71,7 +71,7 @@
|
||||
;;; produce, so that we know how to CREATE TABLEs in PostgreSQL whatever the
|
||||
;;; source is.
|
||||
;;;
|
||||
(defstruct column name type-name type-mod nullable default comment
|
||||
(defstruct column table name type-name type-mod nullable default comment
|
||||
transform extra (transform-default t))
|
||||
|
||||
;;;
|
||||
|
@ -4,6 +4,8 @@ load database
|
||||
|
||||
with include drop, reset no sequences
|
||||
|
||||
cast column impressions.seen_at to "timestamp with time zone"
|
||||
|
||||
distribute companies using id
|
||||
-- distribute campaigns using company_id
|
||||
-- distribute ads using company_id from campaigns
|
||||
|
Loading…
Reference in New Issue
Block a user