Task #56964


Extend SqlSchemaMigrationService to support (basic) ALTER TABLE

Added by Stefan Neufeind over 10 years ago. Updated about 7 years ago.

Should have
Install Tool
Target version:
Start date:
Due date:
% Done:


Estimated time:
TYPO3 Version:
PHP Version:
Sprint Focus:


In typo3/sysext/install/Classes/Service/SqlSchemaMigrationService.php
currently only "CREATE TABLE" is supported. That's used for the normal SQL-statements where fields get defined - or have their type/defaults/... changed by subsequent CREATE TABLE-statements.

For cases like SQL generated by extension-builder it would be great to also have a change to use ALTER TABLE to drop a certain key or field. For that only basic ALTER TABLE-support would be needed.

Actions #1

Updated by Xavier Perseguers over 10 years ago

I don't understand the (real) use case. If you do not define a column in the CREATE TABLE statement (or one of its "extension", adding other fields), any existing column will be suggested to be renamed as zzz_<column_name> in Install Tool, which lets you then safely remove them, again with the Install Tool.

As such I don't see a high need to actively support ALTER TABLE statements.

Actions #2

Updated by Stefan Neufeind over 10 years ago

The only use-case would be to be able to remove existing columns like deleted or hidden or so. You can deactivate them (modify TCA) which helps get the desired effect (for example have records permananetly removed upon delete or offering no disabled/hidden-functionality). But you can not get rid of those DB-columns.
extension_builder currently autogenerated deleted, disabled/hidden and starttime/endtime. But I've also submitted a feature for review there to allow to not generate those fields in the first place (#56965).

Actions #3

Updated by Xavier Perseguers over 10 years ago

I've seen that, but as said, deactivating them in TCA is not enough, if you remove them from the CREATE TABLE statements in the first place, they will be suggested for removal in Install Tool, without any change needed.

Actions #4

Updated by Stefan Neufeind over 10 years ago

Yes, but often you can't just remove the CREATE TABLE. Currently extension-builder autogenerates things like starttime/endtime. And even if you remove from TCA they'll still be in DB. (I've sent a patch to extension-builder for review. If interested please review - not that big actually #56965).
The other case is that not your extension but some other or core provided the CREATE TABLE and there is nothing you can do about it.

Actions #5

Updated by Mathias Schreiber over 9 years ago

  • Target version set to 7 LTS
Actions #6

Updated by Susanne Moog almost 9 years ago

  • Category changed from Install Tool to 1601
Actions #7

Updated by Benni Mack almost 9 years ago

  • Target version changed from 7 LTS to 8 LTS
Actions #8

Updated by Benni Mack over 8 years ago

  • Category changed from 1601 to Install Tool
Actions #9

Updated by Christian Kuhn about 7 years ago

  • Status changed from New to Closed

the solution here is to auto-create most of the ext_tables.sql from TCA, effectively dropping most ext_tables.sql. this work will be done in new tickets.


Also available in: Atom PDF