Skip to content

Data Migration

Tom Mitchell edited this page Nov 29, 2016 · 4 revisions

Data Migration

Data Export

In order to create a portal-only database export from a combined database generate a list of tables with -t flags to use with pg_dump:

find . -name 'schema.sql' -exec grep -i '^create table' {} \; | \
    sed -e 's/CREATE TABLE/  -t/gI' | sed -e 's/($/\\/g' | sort

Then run pg_dump with that list of tables, something like this:

pg_dump --clean -U portal -h localhost portal -f portal-db-dump.sql \
  -t km_asserted_attribute \
  -t km_email_confirm \
  -t last_seen \
  -t lead_request \
  -t rspec \
  -t schema_version \
  -t speaks_for \
  -t user_preferences

Then do the same for the clearinghouse database, running the find command in the geni-ch directory instead of the geni-portal directory. (See https://github.com/GENI-NSF/geni-ch/wiki/Data-Migration)

Data Import

The data exported from the previous step should then be imported into a database at the destination portal as follows:

psql -U $DB_USER -h $DB_HOST -f portal-db-dump.sql $DB_NAME
Clone this wiki locally