Files
apimacro/vendor/spatie/laravel-backup/docs/advanced-usage/binary-database-dumps-with-postgresql.md
2024-05-07 12:17:25 +02:00

929 B

title, weight
title weight
Binary database dumps with PostgreSQL 3

PostgreSQL has the ability to produce binary database dumps via the pg_dump command, which produce smaller files than the SQL format and are faster to restore. See the full list of pg_dump flags.

To take advantage of this, you can set the extra flags for pg_dump on the database connection(s) in app/config/database.php.

//config/database.php
'connections' => [
	'pgsql' => [
		'driver'    => 'pgsql'
		...,
		'dump' => [
		    ...,
		    'add_extra_option' => '--format=c', // and any other pg_dump flags
		]
	],

Additionally, you can change the file extension of the database dump file to signify that it is not a text SQL file.

//config/backup.php
'backup' => [
    ...,
    'database_dump_file_extension' => 'backup', // produces a FILENAME.backup database dump
  ],