Skip to content

Instantly share code, notes, and snippets.

@subhajeet2107
Last active April 29, 2018 17:17
Show Gist options
  • Save subhajeet2107/bd7f1f938d581a8c8c39ab4e8271b11f to your computer and use it in GitHub Desktop.
Save subhajeet2107/bd7f1f938d581a8c8c39ab4e8271b11f to your computer and use it in GitHub Desktop.
mysql to postgres pgloader load file
load database
from mysql://root:password@localhost/database
into pgsql://postgres:root@localhost/database
WITH include drop, create tables, no truncate,
create indexes, reset sequences, foreign keys
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
BEFORE LOAD DO
$$ create schema if not exists database_name; $$;
#sudo pgloader -v ec.load
# Run : ALTER DATABASE db_name SET search_path TO public, db_name; if tables are not visible using \dt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment