Export a CREATE script for a database

前端 未结 5 782
北恋
北恋 2021-01-30 10:22

Say I\'ve created a database in pgAdmin, but I want to export a CREATE sql file.

How would I go about generating the dump?

5条回答
  •  甜味超标
    2021-01-30 10:33

    Here's how to use pgAdmin to create a schema script that can be used with a PostgreSql database schema comparison tool such as apgdiff. These instructions are for pgAdmin3.

    1. In pgAdmin, right click on the database and click Backup.
    2. Enter an appropriate path and filename (i.e. /some/path/my_script.sql).
    3. Select Plain as the format in the format dropdown.
    4. Go to the Dump Options #1 tab and check "Only schema".
    5. Then click Backup. Then click Done.

    Note: Yes, I realize that pgAdmin uses pg_dump behind the scenes to create the script, but the question was about pgAdmin, so this is the GUI method.

提交回复
热议问题