mirror of
https://github.com/dimitri/pgloader.git
synced 2025-08-08 15:27:00 +02:00
This allows creating tables in any target tablespace rather than the default one, and is supported for the various sources having support for the ALTER TABLE clause already.
37 lines
1.1 KiB
Fish
37 lines
1.1 KiB
Fish
load database
|
|
-- from mysql://root@localhost/pgloader
|
|
from mysql://root@unix:/tmp/mysql.sock:3306/pgloader
|
|
into postgresql:///pgloader
|
|
|
|
WITH concurrency = 2,
|
|
multiple readers per thread,
|
|
rows per range = 50000,
|
|
quote identifiers
|
|
|
|
ALTER SCHEMA 'pgloader' RENAME TO 'mysql'
|
|
ALTER TABLE NAMES MATCHING ~/./ SET TABLESPACE 'pg_default'
|
|
|
|
CAST column utilisateurs__Yvelines2013-06-28.sexe
|
|
to text drop not null using empty-string-to-null,
|
|
|
|
column base64.id to uuid drop typemod,
|
|
column base64.data to jsonb using base64-decode,
|
|
|
|
type decimal
|
|
when (and (= 18 precision) (= 6 scale))
|
|
to "double precision" drop typemod,
|
|
|
|
type smallint when unsigned to int drop typemod,
|
|
|
|
type timestamp
|
|
when default "CURRENT_TIMESTAMP"
|
|
with extra on update current timestamp
|
|
to "timestamp with time zone"
|
|
drop default drop not null drop extra
|
|
using zero-dates-to-null,
|
|
|
|
type timestamp with extra on update current timestamp
|
|
to "timestamp with time zone" drop extra
|
|
|
|
BEFORE LOAD DO $$ create schema if not exists mysql; $$;
|