diff --git a/src/parsers/command-mysql.lisp b/src/parsers/command-mysql.lisp index 5f6fb72..c8f0bd7 100644 --- a/src/parsers/command-mysql.lisp +++ b/src/parsers/command-mysql.lisp @@ -68,6 +68,7 @@ gucs casts alter-table + alter-schema materialize-views including-matching excluding-matching @@ -139,7 +140,7 @@ (defun lisp-code-for-loading-from-mysql (my-db-conn pg-db-conn &key gucs casts views before after options - alter-table + alter-table alter-schema ((:including incl)) ((:excluding excl)) ((:decoding decoding-as))) @@ -162,6 +163,7 @@ :excluding ',excl :materialize-views ',views :alter-table ',alter-table + :alter-schema ',alter-schema :set-table-oids t ,@(remove-batch-control-option options)) @@ -172,8 +174,9 @@ (destructuring-bind (my-db-uri pg-db-uri &key - gucs casts views before after - options alter-table including excluding decoding) + gucs casts views before after options + alter-table alter-schema + including excluding decoding) source (cond (*dry-run* (lisp-code-for-mysql-dry-run my-db-uri pg-db-uri)) @@ -186,6 +189,7 @@ :after after :options options :alter-table alter-table + :alter-schema alter-schema :including including :excluding excluding :decoding decoding)))))) diff --git a/src/sources/mysql/mysql.lisp b/src/sources/mysql/mysql.lisp index cf195f5..1e04357 100644 --- a/src/sources/mysql/mysql.lisp +++ b/src/sources/mysql/mysql.lisp @@ -82,7 +82,7 @@ including excluding) "MySQL introspection to prepare the migration." - (let ((schema (add-schema catalog nil)) + (let ((schema (add-schema catalog (catalog-name catalog))) (view-names (unless (eq :all materialize-views) (mapcar #'car materialize-views)))) (with-stats-collection ("fetch meta data" diff --git a/test/sakila-data.load b/test/sakila-data.load index 5c8aafc..914025c 100644 --- a/test/sakila-data.load +++ b/test/sakila-data.load @@ -34,11 +34,14 @@ load database ALTER TABLE NAMES MATCHING 'sales_by_store' RENAME TO 'sales_by_store_list' ALTER TABLE NAMES MATCHING 'film' RENAME TO 'films' + ALTER SCHEMA 'sakila' RENAME TO 'pagila' + -- INCLUDING ONLY TABLE NAMES MATCHING ~/film/, 'actor' - EXCLUDING TABLE NAMES MATCHING ~ + EXCLUDING TABLE NAMES MATCHING ~ ; - BEFORE LOAD DO - $$ create schema if not exists sakila; $$, - $$ create schema if not exists mv; $$, - $$ alter database sakila set search_path to sakila, mv, public; $$; + + -- BEFORE LOAD DO + -- $$ create schema if not exists sakila; $$, + -- $$ create schema if not exists mv; $$, + -- $$ alter database sakila set search_path to sakila, mv, public; $$ diff --git a/test/sakila.load b/test/sakila.load index 6f0f8e6..441b169 100644 --- a/test/sakila.load +++ b/test/sakila.load @@ -8,7 +8,8 @@ load database -- WITH batch rows = 10000 WITH concurrency = 1, workers = 6, - max parallel create index = 4 + max parallel create index = 4-- , + -- quote identifiers SET maintenance_work_mem to '128MB', work_mem to '12MB', @@ -29,11 +30,13 @@ load database ALTER TABLE NAMES MATCHING 'sales_by_store' RENAME TO 'sales_by_store_list' ALTER TABLE NAMES MATCHING 'film' RENAME TO 'films' + ALTER SCHEMA 'sakila' RENAME TO 'pagila' + -- INCLUDING ONLY TABLE NAMES MATCHING ~/film/, 'actor' -- EXCLUDING TABLE NAMES MATCHING ~ BEFORE LOAD DO - $$ create schema if not exists sakila; $$, + $$ create schema if not exists pagila; $$, $$ create schema if not exists mv; $$, - $$ alter database sakila set search_path to sakila, mv, public; $$; + $$ alter database sakila set search_path to pagila, mv, public; $$;