Skip to content

First, it exports schema file from PostgreSQL with "pg_dump --schema-only". Then, parses the schema file for separating the each object types into separate folders and each object into a separate file.

Notifications You must be signed in to change notification settings

onurdemirtas/postgresql.schema.parse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

postgresql.schema.parse

First, it exports schema file from PostgreSQL with "pg_dump --schema-only". Then, parses the schema file for separating the each object types into separate folders and each object into a separate file. You can also parse a previously extracted pg_dump file with this script by making minor changes.

The code consists of 3 parts.

  1. Extracting the schema file with PostgreSQL / pg_dump
  2. Parsing objects to folders and files with the Bash script
  3. Archiving all files and converting them into a single file

You can change any of these parts or use any you want.

Detailed Steps;

  1. Download postgresql.schema.parse.sh file to any folder of you
    schema folder shell
  2. Edit database configuration part in the top of the file
    schema shell dbconfig
  3. Open a terminal window from the folder
  4. Run "bash postgresql.schema.parse.sh"
    schema parse output
  5. You will find a dated tar.gz archive file on the same folder
    schema output archive
  6. You can keep this archive file regularly for schema backup
  7. Extract this archive to a folder for examine any file in it
    schema folder files
  8. You can compare local and prod schema folders with "Meld" folder compare feature
    schema meld

About

First, it exports schema file from PostgreSQL with "pg_dump --schema-only". Then, parses the schema file for separating the each object types into separate folders and each object into a separate file.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages