Feature #33136
closed
Implement Exclude Tables from Compare DB feature in Installtool and Extension installation
Added by Kay Strobach almost 13 years ago.
Updated over 4 years ago.
Description
Hello guys,
during my work for EXT:piwikintegration and other software integrations with TYPO3 i struggled at the point, that the installtool always asked me to drop related tables, which are dynamically created by thirdparty tools.
This way i would like to have the chance to define an array of prefixes for tables which should be completly ignored by sql compare as long as the related extension is installed ;)
Starting point for patch:
t3lib/t3lib_install_sql.php or
sysext/install/Classes/Sql/SchemaMigrator.php ;) --> Thanks Christian
Regards
Kay
from the docs
It's highly recommended to prepend all custom fields and tables with the prefix “user_”. Not only will this prefix never be used for any default tables and fields, but the prefix is also recognized by the Install Tool thus warning you that this table or field is apparently a user-added field or table and thus should not be removed during updates of the database structure:
IMO this is the way to go
ich tried that, but in 4.5 / 4.6, the installtool still suggests me to prepend the tablename with "zzz_deleted_" and remove the tables afterwards:
e.g.
(USER) ALTER TABLE user_piwikintegration_user_language RENAME zzz_deleted_user_piwikintegration_user_language;
my goal is to hide specific tables in the "database compare" dialogue!
- Target version changed from 4.7.0-alpha3 to 4.7.0-beta1
- Target version deleted (
4.7.0-beta1)
- Target version set to next-patchlevel
This problem still exists in 6.2.x
If I prepend tables from 3rd-party tools with "user_", the compare in the install tool still suggests to rename with zzz_deleted.
Thus there is noch possibility to exclude tables.
The result is: no proper database because the risk of renaming unwanted tables is immanent and you will not want to use the compare anymore.
- Target version changed from next-patchlevel to 7.4 (Backend)
Furthermore, not all 3rd party applications allow renaming tables to "user_*" and it would be great if extensions can configure prefixes of excluded tables in ext_tables.php or a similar file, e.g.
array('mshop_', 'madmin_' );
to exclude all tables that start with "mshop_" or "madmin_".
- Category changed from Install Tool to 1601
- Target version changed from 7.4 (Backend) to 7.5
- Target version deleted (
7.5)
- Category changed from 1601 to Install Tool
- Status changed from New to Rejected
imho, you shouldn't mix entirely different table sets of different applications into one db. instead, you you really need to low-level query something from a 3rd party app, put this into an own db and configure doctrine in typo3 for those table to use a second connection.
Most integrators already do this but for tables that have foreign key contstraints to fe_users this doesn't work.
Hi all,
i needed this for a 8.7 setup now, and this seems to do the trick in my ext_localconf.php
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)
->getConnectionByName(\TYPO3\CMS\Core\Database\ConnectionPool::DEFAULT_CONNECTION_NAME)
->getConfiguration()->setFilterSchemaAssetsExpression('/^(?!(prefix1|prefix2)\_).*$/');
In newer versions, the regex is deprecated and replaced by a callback based filter https://github.com/doctrine/dbal/pull/3308
HTH
Andreas
The solution in unfortunately #17 is not perfect. It tells doctrine to ignore these tables, but makes TYPO3 then try to newly create this tables, because it couldn't be "found" in the schema. Which will then lead to another error:
Base table or view already exists: 1050 Table 'tx_ifoobar' already exists
Christian Eßl wrote:
The solution in unfortunately #17 is not perfect. It tells doctrine to ignore these tables, but makes TYPO3 then try to newly create this tables, because it couldn't be "found" in the schema. Which will then lead to another error:
Base table or view already exists: 1050 Table 'tx_ifoobar' already exists
This does mean that TYPO3 knows the tables that you ignore for that connection, doesn't it? IHMO you shouldn't define any SQL in your extension for the tables you are using in your other connection.
Also available in: Atom
PDF