Gamify-IT / issues

fishing basin for all issues in this organization
Other
0 stars 0 forks source link

implement database migration #439

Closed Gr33ndev closed 1 year ago

Gr33ndev commented 1 year ago

https://www.liquibase.org/

madebyTimo commented 1 year ago

@delvh Should we include instructions in our docs stating that on database changes a database changelog should be created and how to create it, or refer to the appropriate part of the Liquibase documentation?

delvh commented 1 year ago

Yep, that's my task as well. I've already documented how to setup the initial changelog, but I still should add instructions for maintaining existing ones.

Aaron2000119 commented 1 year ago

Liquibase doesn't work with our setup docker-container. Is there any way to fix it or do we have to use spring.liquibase.enabled=false to use the docker-compose files.

Aaron2000119 commented 1 year ago

A solution would be to add - spring_liquibase_enabled=false in the docker-compose to every backend. image

delvh commented 1 year ago

But I guess you only mean the test compose files, right?

madebyTimo commented 1 year ago

I think disabling liquibase isn't a good option. The database migration would also be nice for our test data, so we can use them after a database change and dlon't need to create new test data every time. Also this would be necessary to test the migration.

madebyTimo commented 1 year ago

@Aaron2000119 I tested it with our setup container and could not find any problems. What error are you experiencing?

Aaron2000119 commented 1 year ago

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for changeset db/changelog/changelog-1.0.sql::change1-1::leon: Reason: liquibase.exception.DatabaseException: ERROR: relation "configuration" already exists [Failed SQL: (0) CREATE TABLE "configuration" ("id" UUID NOT NULL, "time" INTEGER NOT NULL, CONSTRAINT "configuration_pkey" PRIMARY KEY ("id"))] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.20.jar:5.3.20] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[spring-context-5.3.20.jar:5.3.20] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.20.jar:5.3.20] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.0.jar:2.7.0] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.0.jar:2.7.0] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.0.jar:2.7.0] at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.0.jar:2.7.0] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.7.0.jar:2.7.0] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-2.7.0.jar:2.7.0] at de.unistuttgart.chickenshockbackend.ChickenshockServiceApplication.main(ChickenshockServiceApplication.java:12) ~[classes/:na]

Aaron2000119 commented 1 year ago

The crosswordpuzzle-backend works for me too, but the chickenshock/towercrush/finitequiz doesn't work

delvh commented 1 year ago

Closing this issue as it has been replaced by #477. Please continue the discussion there.