[OpenSER-Devel] Defining MySQL foreign key constraint

Henning Westerholt henning.westerholt at 1und1.de
Mon Jul 16 11:13:41 CEST 2007


On Friday 13 July 2007, you wrote:
> Hello,
>
> Thanks for the answers.
>
> I've discovered one more thing while creating my tables, that we could
> also need TIMESTAMP column types besides DATETIME (in MySQL at least, I
> don't know the correspondence for the other database engines.) One
> advantage of TIMESTAMP
> (http://dev.mysql.com/doc/refman/5.0/en/timestamp.html) is for example
> that you can specify |both DEFAULT CURRENT_TIMESTAMP| and |ON UPDATE
> CURRENT_TIMESTAMP| clauses, and so the column will automatically updated
> to the current timestamp (this is useful in 'last_modified' columns).

Hello Mircea,

i've changed the mysql engine specification according your suggestions.

Regarding the TIMESTAMP:
AFAIK postgres don't provide the ON UPDATE clause. You could work around this 
with a trigger, but for dbtext this is not possible. So i guess this is the 
reason that the logic to update the timestamp is located in openser, and not 
in the database.

Cheers,

Henning



More information about the Devel mailing list