Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow sql dumping via the Makefile #1916

Merged
merged 5 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Guide/database.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ You can also update the database while keeping its contents.

When dumping the database into the `Fixtures.sql` first and then rebuilding the database with the dump, the contents will be kept when changing the schema.

### Transferring/backing up DB
amitaibu marked this conversation as resolved.
Show resolved Hide resolved

To have the full database dumped in a portable manner, you can do `make sql_dump > /tmp/my_app.sql`, which will generate a full SQL database dump, without owner or ACL information.

## Haskell Bindings

### Model Context
Expand Down
3 changes: 3 additions & 0 deletions lib/IHP/Makefile.dist
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ dumpdb: dump_db ## Saves the current database state into the Fixtures.sql
dump_db: ## Saves the current database state into the Fixtures.sql
pg_dump -a --inserts --column-inserts --disable-triggers -h $$PWD/build/db app | sed -e '/^--/d' > Application/Fixtures.sql

sql_dump: ## Saves the current database state, so it can dumped into an SQL file `make sql_dump > dump.sql`
@pg_dump --no-owner --no-acl -h $$PWD/build/db app | sed -e '/^--/d'

build/Generated/Types.hs: Application/Schema.sql ## Rebuilds generated types
mkdir -p build/Generated
build-generated-code
Expand Down
Loading