Review main Abandoned

52808[FEATURE] TCA Schema Service

Armin Vieweg CR 0 V 0 Hard +484 −470 updated 07/14/17, 15:47

Commit message

Introducing new TCA Schema Service which creates system columns in
database (like "uid" or "hidden", etc.) automatically, based on given
TCA configurations.

The feature uses the tablesDefinitionIsBeingBuilt signal to modify
expected SQL structure during database compare.

Review

  • Code review CR 0
  • Verified V 0

Files 18

Review log 1617

  1. Armin Vieweg uploaded patch set 1 05/16/17, 15:20

  2. TYPO3com voted on patch set 1 V -1 05/16/17, 15:27 Completed build in 07m 04s on Tue, 16 May, 05:27 PM Test Summary: 592 of 55853 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-11518

  3. Philipp Gampe commented on patch set 1 05/16/17, 19:00

    TcaSqlBuilder.php:52

    create a dedicated rule registry, where rules can be registered from ext_localconf.php

    TcaSqlBuilder.php:88

    don't check every time, but upon adding to the rule registry
  4. Mathias Brodala commented on patch set 1 05/17/17, 07:44

    composer.json:27

    Why this change?

    RuleInterface.php:18

    I'm not too fond of the naming, maybe "Builder" would be better.

    TcaSqlBuilder.php:88 Reply

    This check can be avoided completely by adding an API to add rules and use it.
  5. Oliver Klee commented on patch set 1 05/17/17, 07:59

    If this is still a WIP, can you please mark it as such in the commit message? And we really need tests for this.

    TcaSqlBuilder.php:2

    Please let's have strict types for all new classes.
  6. Andreas Kienast commented on patch set 1 05/17/17, 13:52

    Please provide a ReST file
  7. Andreas Kienast commented on patch set 1 05/17/17, 13:54

    What happens if an ext_tables.sql still has the definitions like uid, pid etc? Are they (silently) ignored?
    Should be "Resolves", I guess :) Btw, "Releases: master" is missing
  8. Nicole Hummel commented on patch set 1 05/19/17, 07:39

    VersioningWorkspacesRule.php:36

    please use !empty() here to prevent notices

    VersioningWorkspacesRule.php:49

    I would prefer to store those information as a class property and build sql from key => value.
  9. Nicole Hummel commented on patch set 1 05/19/17, 11:50

    BaseRule.php:24

    any reason for a const here? I would prefer to use private static properties as this is nothing we want to publish outside this class.
  10. Nicole Hummel commented on patch set 1 CR -1 05/19/17, 11:58

    RuleInterface.php:32

    what is the extension key for?

    TcaSqlBuilder.php:23

    We should prevent usage of LF constant in new code. IMHO PHP_EOL should be sufficient here.

    TcaSqlBuilder.php:45

    rules should be provided as construct argument
  11. Oliver Klee commented on patch set 1 05/19/17, 12:15

    TcaSqlBuilder.php:23 Reply

    Why shouldn't we use the LF constant?
  12. Nicole Hummel commented on patch set 1 05/19/17, 12:34

    TcaSqlBuilder.php:23 Reply

    This is a constant defined by the TYPO3 bootstrap. IMHO it is not necessary to use it and we should get rid of it. If we introduce new code using that one, it gets harder removing the constant.
  13. Oliver Klee commented on patch set 1 05/19/17, 12:38

    TcaSqlBuilder.php:23 Reply

    I introduced the LF, CR etc. constants at that time so that we could get rid of stuff like chr(10) and double-quoted strings. Should we in you opinion go back to that (for cases where we explicitly need LF etc., not the PHP_EOL), or is there a current solution to use instead?
  14. Nicole Hummel commented on patch set 1 05/19/17, 12:51

    TcaSqlBuilder.php:23 Reply

    In my opinion most of the constants usages are not necessary and can be replace by PHP_EOL without breaking anything. If code needs some special line break I prefer to add it with directly instead of using an own constant.
  15. Oliver Klee commented on patch set 1 05/19/17, 13:01

    TcaSqlBuilder.php:23 Reply

    For the case of special line breaks: Is adding it directly your own preference concerning style, or is there a project-wide decision to not use the constants anymore, i.e., are there plans to remove them (or to not use the TYPO3 tests bootstrap) which I'm not aware of yet?
  16. Morton Jonuschat commented on patch set 1 CR -1 05/25/17, 22:17

    Fair warning, I stopped reading after I saw the SQL fragments all over the place. I think the architectural decision of using SQL fragments to implement this is not the way forward here. Instead of adding more stuff to a text based representation of the Schema that needs parsing of SQL statements is a dead end. This kind of processing should happen later in the process when the SQL from the filesystem has already been parsed into the Doctrine Schema objects. At that point we have full programmatic access to the objects, all overrides from multiple table definitions have been resolved and we can do existence checks on fields, cleanly implement overrides of flags/features on fields, force certain fields to be of a certain type (like all I18n diffSource fields need to be TEXT or UID needs to be unsigned) without messing around with adding/removing/modifying SQL fragments. I would suggest to implement it as a PostProcessor registry/interface (look at the NodeFactory approach in FormEngine) within Database\Schema\Parser\Parser. Each of the "rules" can then be a dedicated PostProcessor. This would be way more flexible and would open the door to solve a few other recurring themes people have been wanting to do with the database, like forcing tables to 'UTF8MB4' on MySQL, rewriting UID fields to be BIGINT, forcing fields to certain types based on the database engine etc...
  17. Armin Vieweg abandoned the change 07/14/17, 15:47

    Just an approach which will not be taken.