Skip to content

Commit b8bdfb2

Browse files
committed
pending work reset me
1 parent bfbe346 commit b8bdfb2

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed

docs/.vitepress/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export default defineConfig({
6161
{ text: 'Installation', link: '/getting-started/installation' },
6262
{ text: 'Basics', link: '/getting-started/basics' },
6363
{ text: 'Supported databases', link: '/getting-started/database-vendors' },
64+
{ text: 'Console tool', link: '/console' },
6465
]
6566
},
6667
{

docs/content/console.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Console tool, the CLI
2+
3+
DbTools ships a standalone console tool for running it as an application.
4+
5+
If installed via composer, simply run:
6+
7+
```sh
8+
./vendor/bin/db-tools
9+
```
10+
11+
This CLI tool runs outside of the framework and application context, therefore requires
12+
that you provide a dedicated configuration file for it.
13+
14+
:::info
15+
A script that generates a working PHAR file is provided in the repository and can be
16+
used to create a self-contained PHAR archive for running in a docker container, on
17+
a baremetal with PHP installed, etc...
18+
19+
Future plans are to provide an official PHAR archive for each stable release.
20+
:::
21+
22+
## Configuration
23+
24+
### Configuration file
25+
26+
The configuration file is a `YAML` file whose available options are strictly identical
27+
to the Symfony bundle configuration with a few additional parameters dedicated to the
28+
standalone application.
29+
30+
:::tip
31+
Please refer to the [configuration reference](configuration/reference) for a complete
32+
and detailled configuration options list.
33+
:::
34+
35+
The most important and required one is the list of available database connections,
36+
using the `connections` configuration option.
37+
38+
```yaml [Standalone]
39+
connections:
40+
connection_one: "pgsql://username:password@hostname:port?version=16.0&other_option=..."
41+
connection_two: "mysql://username:password@hostname:port?version=8.1&other_option=..."
42+
```
43+
44+
Keys are connection names for idenfying those as a command line option, values are
45+
database URL containing all necessary information and options for connecting.
46+
47+
### Environment variables
48+
49+
@todo
50+
51+
### Anonymizer mapping
52+
53+
Anonymizer tables and columns cannot be configured via command line options since
54+
they necessitate a more complex configuration representation. In order to use the
55+
standalone CLI for anonymizing, you are required to create a mapping configuration
56+
file.
57+
58+
File structure is the same as the documented YAML anonymization configuration file
59+
which can be used as-is.
60+
61+
In order to pass configuration, use the `--anonymizer-config=` option or
62+
`DB_TOOLS_ANONYMIZER_CONFIG=` environment variable, followed by a file relative
63+
or absolute path.
64+
65+
For example:
66+
67+
::: code-group
68+
```sh [Option]
69+
./vendor/bin/db-tools --anonymizer-config=my_config.yaml
70+
```
71+
72+
```sh [Env]
73+
DB_TOOLS_ANONYMIZER_CONFIG=my_config.yaml ./vendor/bin/db-tools
74+
```
75+
:::
76+
77+
### Dumping from Symfony configuration
78+
79+
:::warning
80+
When using the CLI tool, you are not in the Symfony application context anymore,
81+
which means the CLI tool doesn't know the Symfony database configuration, doctrine
82+
connections or doctrine ORM mapping.
83+
:::
84+
85+
@todo
86+
87+
## Backup database
88+
89+
90+
91+
## Restore database
92+
93+
94+
## Anonymize

0 commit comments

Comments
 (0)