Skip to content

Instantly share code, notes, and snippets.

@dedunumax
Created March 5, 2020 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dedunumax/d8b2cdbf0218b03fc0c17289ae27a726 to your computer and use it in GitHub Desktop.
Save dedunumax/d8b2cdbf0218b03fc0c17289ae27a726 to your computer and use it in GitHub Desktop.
LOAD DATABASE
FROM mysql://<mysql_user>:<mysql_password>@<mysql_host>/<source_databases>
INTO pgsql://<postgres_user>:<postgres_password>@<postgres_host>/<target_database>
WITH INCLUDE DROP, CREATE TABLES
SET search_path to 'public'
INCLUDING ONLY TABLE NAMES MATCHING 'sample_table'
ALTER TABLE NAMES MATCHING 'sample_table' RENAME TO 'tmp_sample_table'
ALTER SCHEMA '<source_databases>' RENAME TO 'public';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment