Project

General

Profile

Actions

Bug #106546

open

TYPO3 Database Analyzer should ignore tables that exist as views.

Added by Lars Peter Søndergaard 18 days ago. Updated 17 days ago.

Status:
New
Priority:
Should have
Assignee:
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2025-04-10
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
13
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

Actions #1

Updated by Stefan Bürk 17 days ago

  • Category changed from Install Tool to Database API (Doctrine DBAL)
  • Assignee set to Stefan Bürk

Worth looking into it. Added it to my list for doctrine/dbal.

Excluding things is general a thing, in old days this could be
archieved with a setting and later with introduction of doctrine/dbal
using the events, which has been removed by doctrine/dbal 4.

Thanks for reporting this. Keeping it as "bug" report for now, albeit
not sure if we keep that as bug or more as a feature. We will see.

Actions

Also available in: Atom PDF