File tree Expand file tree Collapse file tree 3 files changed +40
-1
lines changed
getting-started/database-dumper Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 65
65
"dragon-code/laravel-migration-actions" : " *"
66
66
},
67
67
"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"
69
70
},
70
71
"minimum-stability" : " stable" ,
71
72
"prefer-stable" : true ,
Original file line number Diff line number Diff line change @@ -104,6 +104,10 @@ export default defineUserConfig({
104
104
{
105
105
text : 'Installation' ,
106
106
link : '/getting-started/installation/index.md'
107
+ } ,
108
+ {
109
+ text : 'Database Dumper' ,
110
+ link : '/getting-started/database-dumper/index.md'
107
111
}
108
112
]
109
113
} ,
Original file line number Diff line number Diff line change
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
+ ```
You can’t perform that action at this time.
0 commit comments