diff --git a/backend/src/main/java/at/ac/tuwien/sepm/assignment/individual/persistence/DataGeneratorBean.java b/backend/src/main/java/at/ac/tuwien/sepm/assignment/individual/persistence/DataGeneratorBean.java index 9e348f3..b76ff8a 100644 --- a/backend/src/main/java/at/ac/tuwien/sepm/assignment/individual/persistence/DataGeneratorBean.java +++ b/backend/src/main/java/at/ac/tuwien/sepm/assignment/individual/persistence/DataGeneratorBean.java @@ -31,7 +31,8 @@ public class DataGeneratorBean { @PostConstruct void insertDummyData() { 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) { LOGGER.error("Error inserting test data", e); } diff --git a/backend/src/main/resources/sql/insertData.sql b/backend/src/main/resources/sql/insertData.sql index 37904dd..ad0202f 100644 --- a/backend/src/main/resources/sql/insertData.sql +++ b/backend/src/main/resources/sql/insertData.sql @@ -5,7 +5,7 @@ VALUES (1, 'Fred', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), (2, 'Julia', 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()), (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())