4

With MySql Workbench, I could create all tables of a database with EER-Diagram, and then do File/Export/Forward Engineer SQL Create Script to generate a sql file that creates the db plus all tables of the db. In Postgresql, with pgAdmin4 or DBeaver, I have created all tables under database/schema, is there any similar way to generate a sql file to create the db and all tables of the db?

1
  • This is usually done with the pg_dump command line tool. Commented Jul 19, 2020 at 5:25

1 Answer 1

3

You export only schema without data using pg_dump in psql [terminal]:

pg_dump -U postgres -s databasename > backup.sql

or with Pgadmin4

  1. Go to Tool -> Backup and select only schema in the Dump option.

Screenshot of Backup

Sign up to request clarification or add additional context in comments.

2 Comments

it backs up as a binary file instead of a sql file with pgadmin
binary? not if I use file.sql name and "Plain" in format field

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.