10
10
11
11
Backup single or multiple database tables with ease.
12
12
13
- > Note: if you want a full database backup with many features go for [ Spatie Laravel Backup] ( https://github.com/spatie/laravel-backup ) .
13
+ > [ !NOTE]
14
+ > If you want a full database backup with many features, go for [ Spatie Laravel Backup] ( https://github.com/spatie/laravel-backup ) .
14
15
15
16
## Installation
16
17
@@ -27,7 +28,7 @@ generate `$tableToBackup_backup_2024_08_22_17_40_01` table in the database with
27
28
the datetime ` 2024_08_22_17_40_01 ` will be varied based on your datetime.
28
29
29
30
You can also use the ` php artisan backup:tables <targets> ` command to back up tables,
30
- where ` <targets> ` is a space-separated list of tables names or models.
31
+ where ` <targets> ` is a space-separated list of table names or models.
31
32
32
33
``` php
33
34
use WatheqAlshowaiter\BackupTables\BackupTables; // import the facade
@@ -45,7 +46,7 @@ class ChangeSomeData
45
46
46
47
And More Customizations
47
48
48
- - You can use an array to backup more than one table
49
+ - You can use an array to back up more than one table
49
50
50
51
``` php
51
52
BackupTables::generateBackup(['users', 'posts']);
@@ -68,9 +69,10 @@ BackupTables::generateBackup([User::class, Post::class]); // users_backup_2024_0
68
69
BackupTables::generateBackup('users', 'Y_d_m_H_i'); // users_backup_2024_22_08_17_40
69
70
```
70
71
71
- > * Note: be aware if you customize the datetime to wide datetime the package will check the backup datetime file and
72
+ > [ !WARNING]
73
+ > Be aware if you customize the datetime to wide datetime the package will check the backup datetime file and
72
74
> will be skipped
73
- > the exact same datetime, so most of the time the default will be fine
75
+ > the same datetime, so most of the time the default will be fine
74
76
> For example: if you use this ` Y_d_m_H ` you can not generate the same backup in the same hour
75
77
76
78
``` php
@@ -81,19 +83,22 @@ BackupTables::generateBackup('users', 'Y_d_m'); // can not generate the same bac
81
83
- Using the artisan command for one or more tables/models
82
84
``` bash
83
85
php artisan backup:tables users posts # users_backup_2024_08_22_17_40_01, posts_backup_2024_08_22_17_40_01
84
- php artisan backup:tables \A pp\M odels\U ser \A pp\M odels\P ost # users_backup_2024_08_22_17_40_01, posts_backup_2024_08_22_17_40_01
86
+ php artisan backup:tables \\ App\\ Models\\ User \\ App\\ Models\ \ Post # users_backup_2024_08_22_17_40_01, posts_backup_2024_08_22_17_40_01
85
87
```
86
88
87
89
## Why?
88
90
89
- Sometimes you want to backup some database tables before changing data for whatever reason, this package serves this
90
- need. I used it personally before adding foreign keys for tables that required the removal of unlinked fields for parent tables.
91
- You may find some situation where you play with table data or you're afraid of missing data so you backup these tables
91
+ Sometimes you want to back up some database tables before changing data for whatever reason, this package serves this
92
+ need.
93
+
94
+ I used it personally before adding foreign keys to tables that required removing unlinked fields from parent tables.
95
+
96
+ You may find some situation where you play with table data, or you're afraid of missing data, so you back up these tables
92
97
beforehand.
93
98
94
99
## Features
95
100
96
- ✅ Backup tables from the code or from the console command.
101
+ ✅ Backup tables from the code using (Facade) or from the console command.
97
102
98
103
✅ Supports Laravel versions: 11, 10, 9, 8, 7, and 6.
99
104
@@ -113,11 +118,15 @@ composer test
113
118
114
119
## Changelog
115
120
116
- Please see [ CHANGELOG] ( CHANGELOG.md ) for more information on what has changed recently .
121
+ Please see [ CHANGELOG] ( CHANGELOG.md ) for more information on recent changes .
117
122
118
123
## Contributing
119
124
120
- If you have any ideas or suggestions to improve it or fix bugs, your contribution is welcome. I encourage you to look at [ todos] ( ./todos.md ) which are the most important features that need to be added. If you have something different, submit an issue first to discuss or report a bug, then do a pull request.
125
+ If you have any ideas or suggestions to improve it or fix bugs, your contribution is welcome.
126
+
127
+ I encourage you to look at [ todos] ( ./todos.md ) which are the most important features that need to be added.
128
+
129
+ If you have something different, submit an issue first to discuss or report a bug, then do a pull request.
121
130
122
131
## Security Vulnerabilities
123
132
0 commit comments