Last active
August 29, 2015 14:04
-
-
Save alazyer/d2275d27b53cf115351b to your computer and use it in GitHub Desktop.
recreate database based on template database on postgresql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As the template database can't be deleted directly, so should change it into non-template database first; | |
$ psql -U postgres postgres | |
$ update pg_database set datistemplate='f' where datname='template_database'; | |
$ drop database template_database; | |
create a database based on the defined template database; | |
$ createdb -T template_database newdatabase; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment