Cloning NoPG databases - sendanor/nor-nopg GitHub Wiki
Here is documentation how to clone an existing NoPG database on the server because NoPG does not yet have a dump and restore utility. (See nopgdump under development.)
Creating user and database from existing database
First you need to create a new user and clone the database:
createuser -P new-user
createdb -O new-user -T old-database new-database
This does not change owner of all relations to new user, so you need to do it manually as superuser:
Tables
You may use command \dt
to list these in psql
console.
ALTER TABLE attachments OWNER TO "new-database";
ALTER TABLE dbversions OWNER TO "new-database";
ALTER TABLE documents OWNER TO "new-database";
ALTER TABLE libs OWNER TO "new-database";
ALTER TABLE types OWNER TO "new-database";
Schemas
You may use command \dn
to list these in psql
console.
ALTER SCHEMA nopg OWNER TO "new-database";
ALTER SCHEMA tv4 OWNER TO "new-database";