Skip to content

Commit 921c7b0

Browse files
committed
Updated docs
1 parent 3c33ca0 commit 921c7b0

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

docs/schema-definition.md

+21-11
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ return [
3030
return $faker->safeEmail;
3131
});
3232
$table->mask('password');
33-
})
34-
->schemaOnly('failed_jobs')
35-
->schemaOnly('password_resets'),
33+
}),
3634
];
3735
```
3836

@@ -48,20 +46,18 @@ return [
4846
];
4947
```
5048

51-
## Dumping table schemas only
49+
## Exclude specific tables from dumps
5250

53-
For certain tables, you do not need to dump the data, but only need the structure of the table itself - like a `password_reset` table. To instruct the masked dumper to only dump the schema, you may use the `schemaOnly` method:
51+
The `exclude()` method allows you to exclude specific tables from the dump. This can be useful if you want to exclude certain tables from the dump:
5452

5553
```php
5654
return [
5755
'default' => DumpSchema::define()
58-
->allTables()
59-
->schemaOnly('password_resets'),
56+
->allTables()
57+
->exclude('password_resets'),
6058
];
6159
```
6260

63-
This configuration will dump all of your tables - but for the `password_resets` table, it will not create any `INSERT` statements and only dumps the schema of this table.
64-
6561
## Masking table column content
6662

6763
To mask the content of a given table column, you can use the `mask` method on a custom table definition. For example, let's mask the `password` column on our `users` table:
@@ -106,7 +102,6 @@ This configuration will dump all users and replace their name with "John Doe".
106102
To gain more flexibility over the replacement, you can pass a function as the second argument. This function receives a Faker instance, as well as the original value of the column:
107103

108104
```php
109-
110105
return [
111106
'default' => DumpSchema::define()
112107
->table('users', function (TableDefinition $table) {
@@ -119,6 +114,21 @@ return [
119114

120115
When dumping your data, the dump will now contain a safe, randomly generated email address for every user.
121116

117+
## Optimizing large datasets
118+
119+
The method TableDefinition::outputInChunksOf(int $chunkSize) allows for chunked inserts for large datasets,
120+
improving performance and reducing memory consumption during the dump process.
121+
122+
```php
123+
return [
124+
'default' => DumpSchema::define()
125+
->allTables()
126+
->table('users', function($table) {
127+
return $table->outputInChunksOf(3);
128+
});
129+
];
130+
```
131+
122132
## Specifying the database connection to use
123133

124134
By default, this package will use your `default` database connection when dumping the tables.
@@ -144,4 +154,4 @@ return [
144154
'sqlite' => DumpSchema::define('sqlite')
145155
->schemaOnly('custom_table'),
146156
];
147-
```
157+
```

0 commit comments

Comments
 (0)