[TYPO3-dev] Default definitions of database fields

Jochen Rau jochen.rau at typoplanet.de
Thu Feb 11 17:45:37 CET 2010


Hi.

Currently the traditional kickstarter produces default field definitions 
like.

starttime int(11) DEFAULT '0' NOT NULL,

These are used by nearly every extension the last few years. As I write 
the documentation for Extbase now, I want to collect best-practice 
solutions and there came up some questions:

Why do we use (11) after int, tinyint? As this makes perfect sense for 
char and varchar, it is IMO useless for int and tinyint because it does 
NOT indicate how many numbers or bytes the field can hold. It just fills 
the integer up with zeroes on the left. A 42 stored in an int(11) field 
is stored as 00000000042. (Don't ask why "42" ;-) )

Why do we need "DEFAULT '0' NOT NULL"? The starttime set to 0 (unix 
timestamp) means that we start 1-1-1970 (I know that TYPO3 handles 0 
different).

IMO we can write

startime int,

but that isn't possible now, because TYPO3 suggests me his version of 
things every time I hit the Extension in the EM.

Any hints?

Regards
Jochen




More information about the TYPO3-dev mailing list