Migrate tables without content #1923
Unanswered
IsraelOrtuno
asked this question in
Q&A
Replies: 1 comment
-
|
@IsraelOrtuno hope this helps :) use Spatie\Backup\Events\DumpingDatabase;
use Spatie\DbDumper\Databases\MySql;
Event::listen(function (DumpingDatabase $event): void {
// for type safety; MariaDb extends MySql
if (!$event->dbDumper instanceof MySql) {
return;
}
$event->dbDumper->excludeTablesData([
'cache',
'pulse_aggregates',
'pulse_entries',
'pulse_values',
'telescope_entries',
'telescope_entries_tags',
'telescope_monitoring',
]);
});See also https://github.com/spatie/db-dumper#excluding-tables-from-the-dump and https://github.com/spatie/db-dumper#excluding-table-data-from-the-dump |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I wonder if there's any way to migrate tables but without content. Tables like
jobs,job_batches,failed_jobsare likely to be marked as excluded but their migration would usually be there so when restoring the backup, these tables won't be created but there will be a record for them in the migrations table which also prevents them from being creating by runningphp artisan migrate. Same could happen with tables fortelescope. I wonder if there's a way to exclude tables data instead.What I am doing now is as soon as I restore the database, I delete a couple of records in the migrations table and then run the migrations again to get those tables created. Not a big deal but error prone process.
Beta Was this translation helpful? Give feedback.
All reactions