Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No issue - Mainly fixes in documentation #207

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions config/db_tools.standalone.complete.sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@
# Default timeout for restore process.
#restore_timeout: 2400 # default 1800

# List here tables (you don't want in your backups.
# List here tables you don't want in your backups.
# If you have more than one connection, it is strongly advised to configure
# this for each connection instead.
#backup_excluded_tables: ['table1', 'table2']

# Specify here paths to backup and restore binaries and command line options.
# Specify here paths to backup and restoration binaries and command line
# options.
# Warning: this will apply to all connections disregarding their database
# vendor. If you have more than one connection and if they use different
# database vendors or versions, please configure those for each connection
Expand All @@ -54,7 +55,7 @@
# Connection name will be "default" when configured this way.
connections: "pgsql://username:password@hostname:port?version=16.0&other_option=..."

# Alternatively, you are allowed to have more than one connections, case
# Alternatively, you are allowed to have more than one connection, case
Lonnytunes marked this conversation as resolved.
Show resolved Hide resolved
# in which you might synthesize the configuration as this:
#connections:
# connection_one: "pgsql://username:password@hostname:port?version=16.0&other_option=..."
Expand All @@ -66,7 +67,8 @@ connections: "pgsql://username:password@hostname:port?version=16.0&other_option=
#connections:
# connection_one:
# # Connection URL for connecting.
# # Please refer to makinacorpus/db-query-builder or documentation for more information.
# # Please refer to makinacorpus/db-query-builder or documentation for
# # more information.
# # Any URL built for doctrine/dbal usage should work.
# # URL is the sole mandatory parameter.
# # Complete list of accepted parameters follows.
Expand All @@ -85,14 +87,15 @@ connections: "pgsql://username:password@hostname:port?version=16.0&other_option=
# url: "mysql://username:password@hostname:port?version=8.1&other_option=..."
# # ...

# You can explicitely set which will be default connection in use when
# none providen in the command line options. If you omit this configuration
# You can explicitly set which will be default connection in use when none
# is provided in the command line options. If you omit this configuration
# value, then the first one in the list will be used.
#default_connection: connection_one

# Update this configuration if you want to look for anonymizers in a custom folder.
# Update this configuration if you want to look for anonymizers in a custom
# folder.
#anonymizer_paths:
#- ./src/Anonymization/Anonymizer'
# - ./src/Anonymizer

# For simple needs, you may simply write the anonymization configuration here.
# Keys are connection names, values are structures which are identical to what
Expand All @@ -112,8 +115,8 @@ anonymization:

# You can for organisation purpose delegate anonymization config into extra
# YAML configuration files, and simply reference them here.
# Pathes can be either relative or absolute. Relative paths are relative to
# the workdir option if specified, or from this configuration file directory
# Paths can be either relative or absolute. Relative paths are relative to
# the workdir option if specified, or from this configuration file directory
# otherwise.
# See the "anonymizations.sample.yaml" in this folder for an example.
anonymization_files:
Expand Down
17 changes: 9 additions & 8 deletions config/db_tools.standalone.sample.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# This configuration file is an example for standalone usage.
# Only required parameter is the connection URL.
# The only required parameter is the connection URL.

# If you have a single connection, you can use this syntax.
# Connection name will be "default" when configured this way.
# If you have multiple connections, please refer to the exhaustive
# sample in 'db_tools.standalone.complete.sample.yaml'.
# sample in 'db_tools.standalone.complete.sample.yaml'.
connections: "pgsql://username:password@hostname:port?version=16.0&other_option=..."

# Where to put generated backups.
Expand All @@ -27,21 +27,22 @@ connections: "pgsql://username:password@hostname:port?version=16.0&other_option=
# (Use relative date/time formats : https://www.php.net/manual/en/datetime.formats.relative.php)
#backup_expiration_age: '6 months ago' # default '3 months ago'

# List here tables (you don't want in your backups.
# List here tables you don't want in your backups.
# If you have more than one connection, it is strongly advised to configure
# this for each connection instead.
#backup_excluded_tables: ['table1', 'table2']

# Update this configuration if you want to look for anonymizers in a custom folder.
# Update this configuration if you want to look for anonymizers in a custom
# folder.
#anonymizer_paths:
#- ./src/Anonymization/Anonymizer'
# - ./src/Anonymizer'

# Write the anonymization configuration here.
# You may also write anonymization configuration in extra files instead, please
# see the 'db_tools.standalone.complete.sample.yaml' for more documentation.
# see the 'db_tools.standalone.complete.sample.yaml' for more documentation.
#anonymization:
# # Keys are connection names, values are structures which are identical to what
# # you may find in the "anonymizations.sample.yaml" example.
# # Keys are connection names, values are structures which are identical to
# # what you may find in the "anonymizations.sample.yaml" example.
# # If you only specified one URL in the "connections" parameter above, the
# # connection name is "default".
# default:
Expand Down
29 changes: 16 additions & 13 deletions config/packages/db_tools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ db_tools:
# - "default": alias of "datetime".
# - "datetime": implementation is "%db_tools.storage_directory%/YYYY/MM/<connection-name>-<datestamp>.<ext>".
# - CLASS_NAME: a class name to use that implements a strategy.
# - SERVICE_ID: A service identifier registered in container that implements a strategy.
# - SERVICE_ID: A service identifier registered in container that
# implements a strategy.
#storage_filename_strategy: default

# When old backups are considered obsolete.
Expand All @@ -29,12 +30,13 @@ db_tools:
# Default timeout for restore process.
#restore_timeout: 2400 # default 1800

# List here tables (you don't want in your backups.
# List here tables you don't want in your backups.
# If you have more than one connection, it is strongly advised to configure
# this for each connection instead.
#backup_excluded_tables: ['table1', 'table2']

# Specify here paths to backup and restore binaries and command line options.
# Specify here paths to backup and restoration binaries and command line
# options.
# Warning: this will apply to all connections disregarding their database
# vendor. If you have more than one connection and if they use different
# database vendors or versions, please configure those for each connection
Expand Down Expand Up @@ -67,16 +69,17 @@ db_tools:
# connection_two:
# # ...

# Update this configuration if you want to look for anonymizers in a custom folder.
# These are default paths that will always be registered even if you override
# the setting so please don't repeat them:
# Update this configuration if you want to look for anonymizers in a custom
# folder.
# Be aware that DbToolsBundle will always take a look at the default folder
# dedicated to your custom anonymizers: %kernel.project_dir%/src/Anonymizer,
# so you don't have to repeat it.
#anonymizer_paths:
#- '%kernel.project_dir%/vendor/makinacorpus/db-tools-bundle/src/Anonymization/Anonymizer/Core'
#- '%kernel.project_dir%/src/Anonymization/Anonymizer'
# - '%kernel.project_dir%/src/Database/Anonymizer'

# For simple needs, you may simply write the anonymization configuration here.
# Keys are connection names, values are structures which are identical to what
# you may find in the "anonymizations.sample.yaml" example.
# For simple needs, you may simply write the anonymization configuration
# here. Keys are connection names, values are structures which are identical
# to what you may find in the "anonymizations.sample.yaml" example.
#anonymization:
# connection_one:
# table1:
Expand All @@ -92,8 +95,8 @@ db_tools:

# You can for organisation purpose delegate anonymization config into extra
# YAML configuration files, and simply reference them here.
# Pathes can be either relative or absolute. Relative paths are relative to
# the workdir option if specified, or from this configuration file directory
# Paths can be either relative or absolute. Relative paths are relative to
# the workdir option if specified, or from this configuration file directory
# otherwise.
# See the "anonymizations.sample.yaml" in this folder for an example.
#anonymization_files:
Expand Down
3 changes: 2 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ To build it locally :
```sh
nvm use
npm ci
npm run docs:dev
npm run docs:dev
```
30 changes: 13 additions & 17 deletions docs/content/anonymization/custom-anonymizers.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

To create one, you will need to

1. add a class in the `src/Anonymizer` directory extends `AbstractAnonymizer`
1. add a class extending `AbstractAnonymizer` in the `src/Anonymizer` directory
2. add the `AsAnonymizer` attribute on it

```php
Expand All @@ -24,8 +24,8 @@ use MakinaCorpus\DbToolsBundle\Attribute\AsAnonymizer;
)]
class MyAnonymizer extends AbstractAnonymizer
{

// ...
// ...
}
```

To understand how an `Anonymizer` works, read `vendor/makinacorpus/db-tools-bundle/src/Anonymizer/AbstractAnonymizer.php`
Expand All @@ -40,7 +40,7 @@ with the [*Anonymizer paths* configuration](../configuration/basics#anonymizer-p

::: tip
To generate its update queries, *DbToolsBundle* uses the *[makinacorpus/query-builder-bundle](https://github.com/makinacorpus/query-builder-bundle) package*.
If you want to create your own anonymizers, you will problably need to take a look at
If you want to create your own anonymizers, you will probably need to take a look at
[its basic uses](https://php-query-builder.readthedocs.io/en/stable/introduction/usage.html).
:::

Expand Down Expand Up @@ -70,21 +70,19 @@ use MakinaCorpus\DbToolsBundle\Attribute\AsAnonymizer;
)]
class MyEnumAnonymizer extends AbstractEnumAnonymizer
{

#[\Override]
protected function getSample(): array
{
// Generate here your sample.

return ['Foo', 'Bar', 'Baz'];
}
}
```

## Mutlicolumn Anonymizers
## Multicolumn Anonymizers

As for an enum anonymizer, if you need to create a mutlicolumn anonymizer based on a big sample, you can extend the
*AbstractMultipleColumnAnonymizer*.
As for an enum anonymizer, if you need to create a multicolumn anonymizer based
on a big sample, you can extend the *AbstractMultipleColumnAnonymizer*.

Here is a complete example:

Expand All @@ -106,8 +104,7 @@ class MyMulticolumnAnonymizer extends AbstractMultipleColumnAnonymizer
#[\Override]
protected function getColumnNames(): array
{
// Declare here name fo each part of your multicolumn
// anonymizer
// Declare here name of each part of your multicolumn anonymizer.
return [
'part_one',
'part_two',
Expand All @@ -119,13 +116,12 @@ class MyMulticolumnAnonymizer extends AbstractMultipleColumnAnonymizer
protected function getSample(): array
{
// Generate here your sample.

return [
['Foo', 'Bar', 'Baz'],
['Foo1', 'Bar1', 'Baz1'],
['Foo2', 'Bar2', 'Baz2'],
['Foo3', 'Bar3', 'Baz3'],
['Foo', 'Bar', 'Baz'],
['Foo1', 'Bar1', 'Baz1'],
['Foo2', 'Bar2', 'Baz2'],
['Foo3', 'Bar3', 'Baz3'],
];
}
}
```
```
2 changes: 1 addition & 1 deletion docs/content/anonymization/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ For example, you can automate this workflow **as a CI job** and therefore use a
to play the *intermediate environment* role.

This approach has many benefits:
* You don't need to backup and restore initial state of this environment:
* You don't need to back up and restore initial state of this environment:
the <span class="standalone">`vendor/bin/db-tools anonymize`</span><span class="symfony">`php bin/console db-tools:anonymize`</span>
will be faster,
* You can store the anonymized backup as a CI artefact, it will then be automatically available for
Expand Down
10 changes: 5 additions & 5 deletions docs/content/backup_restore.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Backup and Restore
# Back up and Restore

*DbToolsBundle* comes with two commands to back up and restore
your database but also a tiny backups manager which handle backup files for you.
*DbToolsBundle* comes with two commands to back up and restore your database
but also a tiny backups manager which handle backup files for you.

## Backup command

Expand Down Expand Up @@ -36,7 +36,7 @@ You can specify the behavior of the command with some options detailed below.

<div class="standalone">

By default, the command will backup the database from the default connection.
By default, the command will back up the database from the default connection.

Lonnytunes marked this conversation as resolved.
Show resolved Hide resolved
If you configured several ones, you can choose to back up a database from a specific
connection with `--connection` option:
Expand All @@ -48,7 +48,7 @@ vendor/bin/db-tools backup --connection other_connection_name
</div>
<div class="symfony">

By default, the command will backup the database from the default DBAL connection.
By default, the command will back up the database from the default DBAL connection.

Lonnytunes marked this conversation as resolved.
Show resolved Hide resolved
You can choose to back up a database from another connection with `--connection` option:

Expand Down
Loading
Loading