TS13: Fix a bug with a false path in the DataGeneratorBean, fix constraint violation in dummy data sql

This commit is contained in:
Ivaylo Ivanov 2020-03-28 16:09:59 +01:00
parent adb28fdf9f
commit 19b5e71f6c
2 changed files with 4 additions and 3 deletions

View File

@ -31,7 +31,8 @@ public class DataGeneratorBean {
@PostConstruct @PostConstruct
void insertDummyData() { void insertDummyData() {
try { try {
ScriptUtils.executeSqlScript(source.getConnection(), new ClassPathResource("src/test/resources/sql/insertData.sql")); LOGGER.info("Inserting dummy data in database");
ScriptUtils.executeSqlScript(source.getConnection(), new ClassPathResource("sql/insertData.sql"));
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("Error inserting test data", e); LOGGER.error("Error inserting test data", e);
} }

View File

@ -5,7 +5,7 @@ VALUES (1, 'Fred', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()),
(2, 'Julia', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), (2, 'Julia', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()),
(3, 'Kim', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()); (3, 'Kim', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP());
INSERT INTO horse(id, name, description, score, birthday, race, image_path, owner, created_at, updated_at) INSERT INTO horse(id, name, description, score, birthday, race, image_path, owner_id, created_at, updated_at)
VALUES (1, 'Dorian', 'The fastest horse on Earth', 5, PARSEDATETIME('2019-01-01', 'yyyy-MM-dd'), 'ARABIAN', 'dorian.png', 1, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), VALUES (1, 'Dorian', 'The fastest horse on Earth', 5, PARSEDATETIME('2019-01-01', 'yyyy-MM-dd'), 'ARABIAN', 'dorian.png', 1, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()),
(2, 'Katrina', 'Not slow, but not fast either', 3, PARSEDATETIME('2005-01-01', 'yyyy-MM-dd'), 'MORGAN', 'katrina.png', 2, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), (2, 'Katrina', 'Not slow, but not fast either', 3, PARSEDATETIME('2005-01-01', 'yyyy-MM-dd'), 'MORGAN', 'katrina.png', 2, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()),
(2, 'Andrew', 'Slowest of the bund', 1, PARSEDATETIME('1992-01-01', 'yyyy-MM-dd'), 'APPALOOSA', 'andrew.png', 3, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()) (3, 'Andrew', 'Slowest of the bunch', 1, PARSEDATETIME('1992-01-01', 'yyyy-MM-dd'), 'APPALOOSA', 'andrew.png', 3, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP())