Error running yaml changelog after using generateChangeLog on database


I’m wondering if someone can provide me some direction on what I’m doing wrong in generating my yaml file. I currently have my changelogs in xml and it was decided we would convert everything to yml. I used the generateChangeLog on my database that was built using the xml to reverse it all into yml. When I try to run my liquibase update with the newly created yml files in a clean database I’m receiving an error. What is happening is my datetime fields that have a defaultValueComputed: CURRENT_TIMESTAMP are being translated to now() in the sql statement and throwing an error during my run. This is what the generateChangeLog created in the create table statement:

    - column:</div>



            nullable: false</div>

        defaultValueComputed: CURRENT_TIMESTAMP</div>

        name: CreateDateTime</div>

        type: datetime(6)</div></div>

and here is the error:

Unexpected error running Liquibase: Invalid default value for ‘CreateDateTime’

…inside the create statement - CreateDateTime datetime(6) DEFAULT NOW() NULL

In case it helps the table that exists in the database was created with the column looking like this in xml:

       <column defaultValueComputed="CURRENT_TIMESTAMP" name="CreatedDateTime" type="datetime"></div>

            <constraints nullable="false"/></div>


I am using liquibase 3.4.1

Thank you!

In case it helps anyone I figured out the issues with the above.

When running the generateChangeLog it gave me a type of datetime(6) which I was then passing defaultValueComputed: CURRENT_TIMESTAMP which was evaluated to now(). Once I changed it to just datetime all is well.

One other issue I was seeing was my constraints were not properly being evaluated so that I was ending up with not null fields or a missing primary key and that turned out to be because of the double “constraints:” lines as seen above. Once I removed one of the “constraints:” my primary keys and null constraints started working correctly.