0

I tested a lot of time and could not resolve one problem. I have a sql changelog for creating tables with changesets inside it. The column Id is Identity, db = h2. I insert data through CSV file and everytime when I try I have a null exception in Id column(Column "ID" contains null values; SQL statement:). I don't understand the reason for it.

  --changeset nikolskiy:2021-10-04--0012-create-tables dbms:h2
DROP TABLE IF EXISTS GENRE;
--changeset nikolskiy:2021-10-04--0013-create-tables dbms:h2
CREATE TABLE GENRE (
    ID   IDENTITY PRIMARY KEY,
    NAME VARCHAR(255)
);


- changeSet:
      id: 2021-10-05--0001-data-genres
      author: nsnikolskiy
      runOnChange: true
      loadUpdateData:
        primaryKey: id
        file: db/changeLog/data/data/2021-10-04--0001-genres.csv
        relativeToChangeLog: true
        separator: ;
        quotChar: '"'
        encoding: UTF-8
        tableName: GENRE

CSV file with Id insert into table(It only works when I write It)

id;name
1;comedy
2;tradegy
3;drama
4;action
5;novel
6;horror
7;satira
8;poetry
9;detective
10;fairy-tale

The exception if csv file without id: Column "ID" contains null values; SQL statement:

0 Answers0