postgresql - Create a dev database with same table structure as production in Postgres 9.3 -


i want create 'development' database web application.

i'm using postgres 9.3, , 'devdb' have exact table structure production 'appdb'. not want them share data, want devdb receive changes made table structures, if possible. (ie. if add new table in appdb, want devdb have new table, same thing if remove column)

do need use schemas this, , if so, how? appdb has schema of public.

thanks!

i think best bet use:

pg_dump --schema-only prod | psql dev 

to keep schemas in sync, either drop , reload dev db, or script schema changes can apply change both dbs. should doing anyway, testing changes in dev before applying them production.

(tools liquibase can interesting this).

attempts link ddl definitions directly unsafe. create dependency production dev. that's risky.

for example, if use table inheritance based approach long-running transaction holding lock on dev tables might cause delays on production.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -