Skip to content

Commit

Permalink
Allow sql dumping via the Makefile (#1916)
Browse files Browse the repository at this point in the history
* make it possible to create a full dump of the instance, tables + data together

* Update lib/IHP/Makefile.dist

Co-authored-by: Amitai Burstein <[email protected]>

* portable dump

* dump

* Update Guide/database.markdown

---------

Co-authored-by: Amitai Burstein <[email protected]>
  • Loading branch information
AronNovak and amitaibu authored Feb 27, 2024
1 parent 4c85cf9 commit cad6e0d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
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

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

0 comments on commit cad6e0d

Please sign in to comment.