You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When starting the application with the following docker-compose definition, restarting the application fails because it is trying to initialize the (then existing) database again:
Is this a bug or is there a way for the application to detect that the database has been initialized already?
When adding SPRING_SQL_INIT_MODE: never after the first run, the application works fine since this forces the application to skip the database initialization.
The text was updated successfully, but these errors were encountered:
backend-1 | Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
backend-1 | ERROR SpringApplication - Application run failed
backend-1 | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Failed to initialize dependency 'dataSourceScriptDatabaseInitializer' of LoadTimeWeaverAware bean 'entityManagerFactory': Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Failed to execute SQL script statement #21 of file [/app/resources/db/postgres/schema.sql]: ALTER TABLE roles ADD CONSTRAINT uni_username_role UNIQUE (role,username)
If so we could try to fix the schema.sql script in order to be reentrant.
Yes, this would work. I was hoping that I was simply missing something in my docker configuration but it looks this is not the case. Submitted a PR for fixing the script: #183.
When starting the application with the following docker-compose definition, restarting the application fails because it is trying to initialize the (then existing) database again:
Is this a bug or is there a way for the application to detect that the database has been initialized already?
When adding
SPRING_SQL_INIT_MODE: never
after the first run, the application works fine since this forces the application to skip the database initialization.The text was updated successfully, but these errors were encountered: