Platform: debian 12.10, amd64, java 21.0.4, liquibase 4.31.1, assertj-db 3.0.0, apache derby 10.14.2.0
I am trying to use loaddata to fill a table with entries.
According to the log output from the changeSet loading the CSV file seems to be running
But the assertj-db assert still says that the table is empty.
The CSV file only has a single columns? Is that a problem?
Here are the changesets that sets up the table and populates the table:
<changeSet author="sb" id="ratatoskr-1.0.0-activity-types-table">
<createTable tableName="activity_types">
<column autoIncrement="true" name="activity_type_id" type="INTEGER">
<constraints primaryKey="true" primaryKeyName="activity_type_primary_key"/>
</column>
<column name="activity_type_name" type="VARCHAR(64)" />
</createTable>
</changeSet>
<changeSet author="sb" id="ratatoskr-1.0.0-populate-activity-types-table" labels="data">
<loadData file="ratatoskr-db-changelog/initial-activity-types.csv" tableName="activity_types" />
</changeSet>
Here is the test code up to the assert that fails (the file containing both changesets is applied in ratatoskrLiquibase.createInitialSchema(datasource.getConnection());
;
@Test
void testCreateSchema() throws Exception {
var ratatoskrLiquibase = new RatatoskrLiquibase();
var datasource = createDataSource("ratatoskr");
var assertjConnection = AssertDbConnectionFactory.of(datasource).create();
ratatoskrLiquibase.createInitialSchema(datasource.getConnection());
var activityTypes = assertjConnection.table("activity_types").build();
assertThat(activityTypes).exists().hasNumberOfRows(13);
Here is the failure message:
java.lang.AssertionError: [ACTIVITY_TYPES table]
Expecting size (number of rows) to be equal to :
<13>
but was:
<0>
at no.priv.bang.ratatoskr.db.liquibase.RatatoskrLiquibaseTest.testCreateSchema(RatatoskrLiquibaseTest.java:52)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Here is the console output from the two changesets:
Running Changeset: ratatoskr-db-changelog/db-changelog-1.0.0.xml::ratatoskr-1.0.0-activity-types-table::sb
May 01, 2025 9:12:42 PM liquibase.changelog
INFO: Table activity_types created
May 01, 2025 9:12:42 PM liquibase.changelog
INFO: ChangeSet ratatoskr-db-changelog/db-changelog-1.0.0.xml::ratatoskr-1.0.0-activity-types-table::sb ran successfully in 8ms
Running Changeset: ratatoskr-db-changelog/db-changelog-1.0.0.xml::ratatoskr-1.0.0-populate-activity-types-table::sb
May 01, 2025 9:12:42 PM liquibase.change
WARNING: Could not snapshot table 'APP.ACTIVITY_TYPES' to get the missing column type information. It is strongly recommended that you augment your loadData operation with a full list of targeted columns and their load data types.
May 01, 2025 9:12:42 PM liquibase.change
WARNING: Could not snapshot table 'APP.ACTIVITY_TYPES' to get the missing column type information. It is strongly recommended that you augment your loadData operation with a full list of targeted columns and their load data types.
May 01, 2025 9:12:42 PM liquibase.statement
INFO: Executing JDBC DML batch was successful. 12 operations were executed, 1 individual UPDATE events were confirmed by the database.
May 01, 2025 9:12:42 PM liquibase.changelog
INFO: Data loaded from 'ratatoskr-db-changelog/initial-activity-types.csv' into table 'activity_types'
May 01, 2025 9:12:42 PM liquibase.changelog
INFO: ChangeSet ratatoskr-db-changelog/db-changelog-1.0.0.xml::ratatoskr-1.0.0-populate-activity-types-table::sb ran successfully in 59ms
Here is the contents of initial-activity-types.csv (a single column with the column name as the first row:
activity_type_name
Add
Announce
Create
Delete
Dislike
Follow
Like
Remove
Update
Accept
Ignore
Reject