Jul 17, 2014

What is wrong with these pieces of code?

First:

CREATE TABLE tt_news_cat_mm (
  uid_local int(11) DEFAULT '0' NOT NULL,
  uid_foreign int(11) DEFAULT '0' NOT NULL,

Second:

$selectConf['leftjoin'] = 'tt_news_cat_mm ON tt_news.uid = tt_news_cat_mm.uid_local';
$selectConf['where'] .= ' AND tt_news_cat_mm.uid_foreign IS' .
($this->config['categoryMode'] > 0 ? '' : ' NOT') . ' NULL';


Your opinion?

4 comments:

  1. 1) DEFAULT '0' could be ommited. It will be 0 by default anyway
    2) ' AND tt_news_cat_mm.uid_foreign IS (NOT) NULL' - overhead, can't be NULL anyway

    ReplyDelete
    Replies
    1. #1 is more for TYPO3 SQL parser, which will complain if it is not there. But I thought about #2, which definitely does not make sense. So many interesting things in tt_news...

      Delete
    2. I think it should be migrated to extbase (is there already an extbase replacement btw?) :)
      Big work expected there, of course. Migration may be harder than wrting from scratch 3.0 version without backward compatibility.

      Delete
    3. Haven't you thought about true db migraton system for typo3 extensions? E.g. each extension may have folder called migrations with php classes which are implementing some core abstract class with up and down methods. And one core table with id, migration_id, ext_key. Or smth like that.

      Delete