I’m trying to use liquibase to create some basic tables in an sqlite db but it’s giving me an error when it tries to insert the the changeset log in the DATABASECHANGELOG table.
This is my changelog in YAML format:
databaseChangeLog:
- changeSet:
id: 1
author: knightsg
changes:
- createTable:
tableName: tracked_posts
columns:
- column:
name: id
type: text
constraints:
primaryKey: true
nullable: false
- column:
name: parsed_at
type: timestamp
constraints:
primaryKey: false
nullable: false
defaultValue: 'CURRENT_TIMESTAMP'
- createTable:
tableName: checks
columns:
- column:
name: name
type: text
constraints:
primaryKey: true
nullable: false
- column:
name: count
type: int
constraints:
primaryKey: false
nullable: false
defaultValue: 0
- column:
name: change
type: int
constraints:
primaryKey: false
nullable: false
defaultValue: 0
- column:
name: value
type: real
constraints:
primaryKey: false
nullable: false
defaultValue: 0.0
- column:
name: parsed_at
type: timestamp
constraints:
primaryKey: false
nullable: false
defaultValue: 'CURRENT_TIMESTAMP'
The error i get is as follows:
Unexpected error running Liquibase: [SQLITE_CONSTRAINT] Abort due to constraint violation (NOT NULL constraint failed: DATABASECHANGELOG.ID) [Failed SQL: (19) INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES (NULL, NULL, ‘changelog/baseline.yml’, CURRENT_TIMESTAMP, 1, ‘8:d41d8cd98f00b204e9800998ecf8427e’, ‘empty’, ‘’, ‘EXECUTED’, NULL, NULL, ‘4.2.2’, ‘2838090685’)
For some reason liquibase is trying to insert the ID and author values as null. Does anyone know how to fix this?
Thanks