Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/onurdemirtas/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.
https://github.com/onurdemirtas/postgresql.schema.parse
backup bash bash-script compare linux meld parser postgresql postgresql-database schema ubuntu
Last synced: 9 days ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/onurdemirtas/postgresql.schema.parse
- Owner: onurdemirtas
- Created: 2024-12-14T12:25:12.000Z (20 days ago)
- Default Branch: main
- Last Pushed: 2024-12-14T14:26:23.000Z (20 days ago)
- Last Synced: 2024-12-14T15:25:00.171Z (20 days ago)
- Topics: backup, bash, bash-script, compare, linux, meld, parser, postgresql, postgresql-database, schema, ubuntu
- Language: Shell
- Homepage:
- Size: 233 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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 fileYou 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](https://github.com/user-attachments/assets/23750bfa-8da6-465b-912c-b05290185254)
2. Edit database configuration part in the top of the file
![schema shell dbconfig](https://github.com/user-attachments/assets/fed78059-630f-417b-ba81-12ff7edad203)
3. Open a terminal window from the folder
4. Run "bash postgresql.schema.parse.sh"
![schema parse output](https://github.com/user-attachments/assets/b7b1ba3e-ebd3-4f01-9e31-39cb913109e5)
5. You will find a dated tar.gz archive file on the same folder
![schema output archive](https://github.com/user-attachments/assets/3d9e6284-3a4f-4fb7-b560-2d175d39aee3)
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](https://github.com/user-attachments/assets/faa1766a-0c53-4027-b58d-cd7d7d356a64)
8. You can compare local and prod schema folders with "Meld" folder compare feature
![schema meld](https://github.com/user-attachments/assets/db907170-7152-4e98-8fd7-c01c1597d6e2)