auto updating timestamp ?

Ok, new issues after trying nvoxland solution and some other little changes, the generated SQL looks like this now :


  1. CREATE TABLE __test (

So is there a bug that make timestamps impossible to be null ?


Thanks for your answers (but the main problem of ON UPDATE clause remains unsolved :/)


Kitensei.

I guess you need to specify a function that is specific to your DBMS. In MySQL you could use “now()” instead of “CURRENT_TIMESTAMP”

not working any better, the SQL generated looks like this : 


  1. CREATE TABLE `___test` (
  2. CONSTRAINT `PK____TEST` PRIMARY KEY (`idPARAM`)
  3. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci

the dateModif field is still converted to DATETIME field

Try using defaultValueComputed instead of defaultValue. It is assuming you mean the string CURRENT_TIMESTAMP or ‘NOW()’. defaultValueComputed means it is not a string but a function.


Nathan

Hi, after taking a look around the forum I haven’t found any answer working for my problem.


How do you write the following MySQL code in liquibase XML structure ?


  1.  TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

I have tried the following, but without success


  1.      
The field is transformed in DATETIME and no "on update" clause on it.


Thank you previously.

1 Like

that’s what I am actually doing Nathan, I use tag for create tables.

I’ll take a look to the website to see if no issue is open, then i’ll open a new one, 


thanks for answering


Kitensei.

One option that may work if you have a hard time getting a change to work is to just fall back to and specify exactly what you want, or use on the change to fix up/add anything that isn’t directly supported.


Mysql creates timestamp columns as not null by default. I wonder if liquibase is expecting that columns are nullable by default and so not passing on your nullable=true constraint. That may be worth creating an issue at liquibase.jira.com on


Nathan