[TYPO3-dev] Database compare and database modification inconsistencies

Adrien Crivelli adrien.crivelli at gmail.com
Tue Jan 3 10:18:31 CET 2012


Hello,

AFAIK there is no way to alter an existing field to be NOT NULL. You can
create a new one, but not modify it. To me it seems highly incoherent.
Especially since the EM will not correctly display the current status of
things.

Example:

First create a simple table, with this SQL in ext_tables.sql:
CREATE TABLE atest (
nullable varchar(255) DEFAULT '',
not_nullable varchar(255) DEFAULT '' NOT NULL,
);

Then modify ext_tables.sql to look like this, we add NOT NULL and remove
NOT NULL:
CREATE TABLE atest (
nullable varchar(255) DEFAULT '' NOT NULL,
not_nullable varchar(255) DEFAULT '',
);

The Extension Manager will show that everything is already up to date and
the database will not be altered. According to the patch mentioned this is
done intentionally, but I fail to understand why it was decided so. From
what I gather it was a "dirty fix" which still have sneaky side-effects.

I believe there is also a similar problem with DEFAULT, but I can't
remember the exact case...

I also understand why SQL is re-formatted (re-ordering, uppercase, etc.),
but not why its meaning is changed (totally ignoring NOT NULL clause in
this case)...

Adrien


On 3 January 2012 17:46, Xavier Perseguers <xavier at typo3.org> wrote:

> Hi,
>
> Steffen Gebert wrote:
> >> The database compare and database modification have inconsistencies
> which
> >> are quite confusing. It's quite easy to write an ext_tables.sql which
> >> will
> >> be applied on database, but actually never show as "up do date" in
> >> extension manager (so it seems it didn't apply). This is mostly
> >> because of
> >> limitation around "NOT NULL" and "DEFAULT" values.
> >
> > Xavier, what's the opinion of the DBAL fraction?
>
> Just went through this post and the answer to "why SQL is rewritten" is
> to be understandable and compatible with DBAL.
>
> Without reading further, I don't really see the problem as IIRC I always
> was able to write a valid ext_tables.sql file which was both compatible
> with EM and with what I wanted to achieve, and thus valid with DBAL as
> well.
>
> --
> Xavier Perseguers
> Release Manager TYPO3 4.6
>
> TYPO3 .... inspiring people to share!
> Get involved: http://typo3.org
>
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev
>



More information about the TYPO3-dev mailing list