I've got this Spring Boot application that is working with a PostgreSQL database. The application-dev.properties file is as follows:
spring.datasource.platform=postgres
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=postgres
spring.datasource.password=root
spring.datasource.data=classpath:/sql/dev-data.sql
spring.jpa.properties.hibernate.default_schema=myschema
spring.jpa.show-sql=true
spring.jpa.database=POSTGRESQL
The database is installed in my development machine, and already initialized. The dev-data.sql file is in src/main/resources/sql and right now only deletes everything on a specific table (lets call it myschema.example_table) and inserts some registries. (This is intended to check the functionality works than for an actual use):
delete from myschema.example_table where id > 0;
insert into myschema.example_table (id, val1, val2) values (1, "Hello", "Petecander");
insert into myschema.example_table (id, val1, val2) values (2, "Goodbye", "Gromenauer");
My issue is that... nothing happens. Is as if there wasn't anything related to the dev-data.sql file at all. So, I'm completely at a loss here. I've been browsing for a while, and reading about a lot of different switches that can be enabled on the application.properties file, but nothing. Any idea?
EDIT: Just to provide a bit more of info that I've been asked down there: The application loads fine and can perform some basic CRUD stuff against the database (Just read stuff at the moment), so the application-dev.properties file seems that is being loaded right.
dev-data.sql? Why notdata.sql?spring.datasource.platform=postgresis necessary since spring will determine the db from the URL where possible. Presumably if you're running this against localhost you've mapped the port from a docker container? Is5432the right port? You've specified DB aspostgresbut schema asmyschemafor hibernate - could this be an issue? Presumably when you're spring boot app it sets the profile todevso thatapplication-dev.propertiesis the property source in use? I can think of ways to test but there's questions that need answering before you can have a plan to debug this