Download the PHP package weslinkde/laravel-postgres-tools without Composer
On this page you can find all versions of the php package weslinkde/laravel-postgres-tools. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download weslinkde/laravel-postgres-tools
More information about weslinkde/laravel-postgres-tools
Files in weslinkde/laravel-postgres-tools
Package laravel-postgres-tools
Short Description Some handy helper function for PostgresSQL Databases
License MIT
Homepage https://github.com/weslinkde/laravel-postgres-tools
Informations about the package laravel-postgres-tools
This package provides some tools to make working with postgres easier. It comes with a command to create a snapshot of your database and a command to restore a snapshot. We created this package to handle huge databases (+16GB). Big thanks to Spatie for their great packages, especially the laravel-db-snapshots package, which we use to create snapshots. You can also create new databases, drop existing ones or clone them.
Installation
You can install the package via composer:
You can publish the config file with:
This is the contents of the published config file:
Usage
To create a snapshot (which is just a dump from the database), run:
Giving your snapshot a name is optional. If you don't pass a name, the current date time will be used:
Maybe you only want to snapshot a couple of tables.
You can do this by passing the --table
multiple times or as a comma separated list:
You may want to exclude some tables from snapshot.
You can do this by passing the --exclude
multiple times or as a comma separated list:
Note: if you pass
--table
and--exclude
in the same time it will use--table
to create the snapshot, and it'd ignore the--exclude
After you've made some changes to the database, you can create another snapshot:
To load a previous dump issue, this command:
To load a previous dump to another DB connection (but the driver has to be pgsql):
A dump can be deleted with:
You can create new databases with:
And you can drop existing databases with:
Note: This action is irreversible. It will drop the database, on production it will ask you for your confirmation.
It is also possible to clone an existing database with:
It will create a new database for you. If the new database already exists, it won't do anything.
Events
For convenience, we're using the events from Spaties package. There are several events fired that can be used to perform some logic of your own:
Spatie\DbSnapshots\Events\CreatingSnapshot
: will be fired before a snapshot is createdSpatie\DbSnapshots\Events\CreatedSnapshot
: will be fired after a snapshot has been createdSpatie\DbSnapshots\Events\LoadingSnapshot
: will be fired before a snapshot is loadedSpatie\DbSnapshots\Events\LoadedSnapshot
: will be fired after a snapshot has been loadedSpatie\DbSnapshots\Events\DeletingSnapshot
: will be fired before a snapshot is deletedSpatie\DbSnapshots\Events\DeletedSnapshot
: will be fired after a snapshot has been deleted
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Dominik Lenz
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-postgres-tools with dependencies
illuminate/contracts Version ^10.0 || ^11.0
laravel/prompts Version ^0.1.14
spatie/laravel-db-snapshots Version ^2.5
spatie/laravel-package-tools Version ^1.14.0