mirror of
https://github.com/dimitri/pgloader.git
synced 2025-08-10 08:17:00 +02:00
Also, in passing, ass a new transformation function for MySQL allowing to transform from varbinary to text.
50 lines
1.6 KiB
Fish
50 lines
1.6 KiB
Fish
LOAD DATABASE
|
|
FROM mysql://root@unix:/tmp/mysql.sock:/goeuro
|
|
INTO postgresql://dim@unix:/tmp:/godollar
|
|
|
|
-- INCLUDING ONLY TABLE NAMES MATCHING ~/sizes/
|
|
EXCLUDING TABLE NAMES MATCHING ~/encoding/
|
|
|
|
DECODING TABLE NAMES MATCHING ~/messed/, ~/encoding/ AS utf-8
|
|
|
|
SET maintenance_work_mem to '1 GB'
|
|
|
|
CAST type datetime to timestamptz drop default drop not null using zero-dates-to-null,
|
|
type date drop not null drop default using zero-dates-to-null,
|
|
type timestamp to timestamptz drop not null using zero-dates-to-null,
|
|
|
|
-- now the default for tinyint(1)
|
|
-- column bools.a to boolean drop typemod using tinyint-to-boolean,
|
|
|
|
-- override char(1) to varchar(1), just use char(1) here.
|
|
type char when (= precision 1) to char keep typemod,
|
|
|
|
-- bit(1) is a boolean too!
|
|
-- it's a default setting, just shows how to type it in
|
|
type bit when (= precision 1) to boolean drop typemod using bits-to-boolean,
|
|
|
|
column ascii.s using byte-vector-to-bytea,
|
|
column enumerate.foo using empty-string-to-null,
|
|
|
|
column ip.ip_address to inet keep not null drop typemod,
|
|
|
|
type decimal when (= precision 1) to boolean drop typemod,
|
|
|
|
-- type varbinary to text drop typemod using babel:octets-to-string
|
|
type varbinary to text drop typemod using varbinary-to-string
|
|
|
|
MATERIALIZE VIEWS nonexisting,
|
|
d as $$
|
|
select cast(d as date) as d, count(*) as n
|
|
from plop
|
|
where d > '2013-10-02'
|
|
group by cast(d as date);
|
|
$$
|
|
|
|
WITH include drop,
|
|
create tables,
|
|
create indexes,
|
|
preserve index names,
|
|
reset sequences,
|
|
disable triggers;
|