Restore Postgres Dump to Ash
This is how to restore a pg_dump to an Postgres database managed by Ash. Bet you're excited.
I like to do data only dump/restores. This is so that Ash can keep track of all the initial table creation and migrations.
Dump It
Let's dump the data from a Postgres data source. Let's say it's production data that you're trying to get into that little dev environment of yours:
pg_dump --data-only --inserts -U my-user -h dev-postgres.my-host.com -d my-db-name > prod.sqlNote --data-only (avoids DDL commands) and --inserts (specifies the dump in sql insert queries).
Drop It
Now get Ash to drop all the data and the tables. Napalm that pg!
mix ash_postgres.dropRecreate It
Now Ash can reverse course and make all those tables for you again, running migrations 1 to latest.
mix ash_postgres.createRestore It
Now to get the data from your other data source loaded into your local postgres. You have to use psql because it's plaintext sql.
psql --host localhost --username my-user -d my-db-name -f prod.sqlBop it.