Create Database from a Template
Today I got to see Postgres' createdb invoked with a specified template, as such:
$ createdb -T prod_dump myapp_development
The -T feature flag corresponds to the TEMPLATE modifier in a SQL CREATE DATABASE statement. In the example above, this will create myapp_development that is a deep clone (structure and data) of prod_dump.
For more info, see:
$ man createdb
and:
$ psql
user=# \h create database;
h/t Brian Dunn
Tweet