#106546TYPO3 Database Analyzer should ignore tables that exist as views.
Description
In one of our project, we have an external database and a few TCA models mapped onto views of that external database (using TYPO3_CONF_VARS TableMapping configuration).
Specifically, we have a configuration like the following:
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['External'] = [
'dbname' => 'dnmame',
'user' => 'user',
// ...
];
$GLOBALS['TYPO3_CONF_VARS']['DB']['TableMapping'] ??= [];
$GLOBALS['TYPO3_CONF_VARS']['DB']['TableMapping']['sample_view_1'] = 'External';
$GLOBALS['TYPO3_CONF_VARS']['DB']['TableMapping']['sample_view_2'] = 'External';
AND The tables (views) sample_view_1 and sample_view_2 are configured as proper TCA tables.
In TYPO3 10 this worked fine – they’re properly ignored – as it did not have the TCA related schema migration yet, but in TYPO3 13 (possibly earlier) it now tries to create those tables in the foreign database due to the existing TCA configuration, despite them already existing as views (I assume the relevant migrator only looks for tables).
This obviously fails, as you cannot create tables with the same name as an existing view.
I could follow it to the SchemaMigrator, that creates a schema entry for every tables managed by TCA, and in the ConnectionMigrator where the diff is built.
Currently I solve the issue by hooking into the AlterTableDefinitionStatementsEvent event, and just removing all my custom TCA entries. As that event is only used in the install tool, that seems to be fine to me.
But it would be nice to have better control over how things are detected by the Database Analyzer.
Greetings
LP
Reviews 3
- main 95240[BUGFIX] Ignore tables that exist as views
- 14.3 95390[BUGFIX] Ignore tables that exist as views
- 13.4 95391[BUGFIX] Ignore tables that exist as views
Fix this issue
Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". The changes above were merged or abandoned: read them before you start. How to create a patch
- Commit message
-
[BUGFIX] TYPO3 Database Analyzer should ignore tables that exist as views. Resolves: #106546 Releases: main