Schema
Creating audit tables
doctrine-provider
The process of audit table creation differs depending on your current setup:
- single storage service setup: audit tables are stored in the same database than audited ones (most common use case)
- multiple storage services setup: audit tables are stored in a multiple databases
Single storage service setup (most common use case)
Open a command console, enter your project directory and execute the following command to review the new audit tables in the update schema queue.
# symfony < 3.4
app/console doctrine:schema:update --dump-sql
# symfony >= 3.4
bin/console doctrine:schema:update --dump-sql
Using DoctrineMigrationsBundle
# symfony < 3.4
app/console doctrine:migrations:diff
app/console doctrine:migrations:migrate
# symfony >= 3.4
bin/console doctrine:migrations:diff
bin/console doctrine:migrations:migrate
Using Doctrine Schema
# symfony < 3.4
app/console doctrine:schema:update --force
# symfony >= 3.4
bin/console doctrine:schema:update --force
Multiple storage services setup
Doctrine Schema-Tool and DoctrineMigrationsBundle are not able to work with more than one
database at once. To workaround that limitation, this bundle offers a migration command that
focuses on audit schema manipulation.
Open a command console, enter your project directory and execute the following command to review the new audit tables in the update schema queue.
# symfony < 3.4
app/console audit:schema:update --dump-sql
# symfony >= 3.4
bin/console audit:schema:update --dump-sql
Once you're done, execute the following command to apply.
# symfony < 3.4
app/console audit:schema:update --force
# symfony >= 3.4
bin/console audit:schema:update --force
Updating the schema
doctrine-provider
After updating auditor library of auditor-bundle, the schema might need to be updated,
you can do so by using the audit:schema:update command.
This ensures that:
- all audit tables are created
- all audit tables have the expected structure and updates them if needed
Open a command console, enter your project directory and execute the following command to review the new audit tables in the update schema queue.
# symfony < 3.4
app/console audit:schema:update --dump-sql
# symfony >= 3.4
bin/console audit:schema:update --dump-sql
Once you're done, execute the following command to apply.
# symfony < 3.4
app/console audit:schema:update --force
# symfony >= 3.4
bin/console audit:schema:update --force