Skip to content

Commit 82986a6

Browse files
Added suggestion for dragon-code/laravel-data-dumper
1 parent d52c356 commit 82986a6

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@
6565
"dragon-code/laravel-migration-actions": "*"
6666
},
6767
"suggest": {
68-
"doctrine/dbal": "This package must be installed if you are using Laravel 10."
68+
"doctrine/dbal": "This package must be installed if you are using Laravel 10.",
69+
"dragon-code/laravel-data-dumper": "Required if you want to save the execution state using the `schema:dump` console command"
6970
},
7071
"minimum-stability": "stable",
7172
"prefer-stable": true,

docs/.vuepress/config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ export default defineUserConfig({
104104
{
105105
text: 'Installation',
106106
link: '/getting-started/installation/index.md'
107+
},
108+
{
109+
text: 'Database Dumper',
110+
link: '/getting-started/database-dumper/index.md'
107111
}
108112
]
109113
},
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Database Dumper
2+
3+
As you build your application, you may accumulate more and more migrations over time.
4+
This can lead to your `database/migrations` directory becoming bloated with potentially hundreds of migrations.
5+
If you would like, you may "squash" your migrations into a single SQL file.
6+
To get started, execute the `schema:dump` command:
7+
8+
```bash
9+
php artisan schema:dump
10+
11+
# Dump the current database schema and prune all existing migrations...
12+
php artisan schema:dump --prune
13+
```
14+
15+
You can read more about the operation of this console command in
16+
the [official documentation](https://laravel.com/docs/11.x/migrations#squashing-migrations).
17+
18+
Here we mention this console command because operations tend to save the execution state in order to prevent re-runs
19+
where this is not explicitly allowed.
20+
But if you run sequentially the console commands `php artisan schema:dump` and `php artisan migrate:fresh`, you will see
21+
that all actions will be called again.
22+
23+
This is due to the fact that the dump mechanism saves the contents of just one table - `migrations`.
24+
25+
To solve this problem, there is a [Database Data Dumper](https://github.com/TheDragonCode/laravel-data-dumper)
26+
project that allows you to specify a list of tables required for export to a dump.
27+
28+
In addition to those that you can easily specify in its configuration file, we recommend that you also specify
29+
the `operations` table from this project in order to save the state of the operations when performing a clean deployment
30+
of the database from a dump.
31+
32+
```bash
33+
composer require dragon-code/laravel-data-dumper --dev
34+
```

0 commit comments

Comments
 (0)