File: my.load

package info (click to toggle)
pgloader 3.6.10-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,060 kB
  • sloc: sql: 32,321; lisp: 14,793; makefile: 435; sh: 85; python: 26
file content (45 lines) | stat: -rw-r--r-- 1,458 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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'

 -- INCLUDING ONLY TABLE NAMES MATCHING 'encryption_key_canary'

 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,

      -- This is now a default casting rule for MySQL
      -- type bigint when signed to bigint drop typemod,

      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,

      column encryption_key_canary.uuid
          to uuid drop typemod using byte-vector-to-hexstring

 BEFORE LOAD DO
   $$ create schema if not exists mysql; $$;