laravel-masked-db-dump icon indicating copy to clipboard operation
laravel-masked-db-dump copied to clipboard

Add two new features: 1) exclude($tableName) 2) outputInChunksOf($chunkSize)

Open k2idev opened this issue 5 years ago • 0 comments

Hi,

I have added two new features.

  1. Ability to exclude a table from the export:

Sometimes you might not want to include all tables in the export. You can achieve this with:

return [
    'default' => DumpSchema::define()
                    ->allTables()
                    ->exclude('password_resets')
                    ->exclude('migrations');
];
  1. Ability to create INSERTs with multiple rows

When you have a table with many rows (1000+) creating INSERT statements for each row results in a very slow import process. For these cases it is better to create INSERT statements with multiple rows.

You can achieved this with ->outputInChunksOf($n).

return [
    'default' => DumpSchema::define()
        ->allTables(),
        ->table('users', function($table) { 
                return $table->outputInChunksOf(25); 
            });
];

Tests

  • I have fixed the existing tests (they used artisan db:dump instead of db:masked-dump)
  • I have added a test for exclude()
  • I have added a test for outputInChunksOf()

Documentation

I have added two sections describing the features in the Readme.md file.

Liebe Grüße Alex

PS: It's my first pull request ever for an open source project ... so I hope I didn't miss anything :) PPS: Thank you for all the great work and stuff you are providing!

k2idev avatar Mar 06 '21 11:03 k2idev