Insert value defined in JSON changelog is ignored

Description

The second changeset in the following json changelog file contains a single insert command, but is not working as expected:

{ "databaseChangeLog": [ { "preConditions": [ { "dbms": { "type": "postgresql" }, "runningAs": { "username": "postgres" } } ] }, { "changeSet": { "id": "1", "author": "fernando.costa", "changes": [ { "createTable": { "tableName": "contact", "columns": [ { "column": { "name": "id", "type": "bigint", "autoIncrement": true, "constraints": { "primaryKey": true, "nullable": false } } }, { "column": { "name": "first_name", "type": "varchar(100)", "constraints": { "nullable": false } } } ] } } ] } }, { "changeSet": { "id": "2", "author": "fernando.costa", "changes": [ { "insert": { "tableName": "contact", "columns": [ { "column": { "name": "first_name", "value": "'George'" } } ] } } ] } } ] }

It throws this error:

SEVERE 12/9/16 5:30 AM:liquibase: db.changelog.json: db.changelog.json::2::fernando.costa: Change Set db.changelog.json::2::fernando.costa failed. Error: Error executing SQL INSERT INTO contact (first_name) VALUES (NULL): ERROR: null value in column "first_name" violates not-null constraint Detail: Failing row contains (1, null).

I set first_name to George, but Liquibase seems to ignore it and generates a SQL statement with a NULL value.

Environment

Java (1.8), Maven (3.3.9) and PostgreSQL (9.5.4).

Activity

Show:

FernandoC December 9, 2016 at 10:27 PM
Edited

I found a similar error related to YAML changelog format.

Details

Reporter

Components

Affects versions

Priority

Created December 9, 2016 at 4:27 PM
Updated December 9, 2016 at 10:28 PM

Flag notifications