~jan0sch/smederee

Showing details for patch 0b644a46fb1e27f92fceb3dc6c5c9572ea6081c7.
2023-03-21 (Tue), 4:52 PM - Jens Grassel - 0b644a46fb1e27f92fceb3dc6c5c9572ea6081c7

Fix: Database schemas not properly created upon startup.

- create two migrators properly
- migrate hub and tickets database schemas as expected

Fixes: 252c14a83f46a13760979e5af3a79fb46772670a
Summary of changes
1 files modified with 8 lines added and 2 lines removed
  • modules/hub/src/main/scala/de/smederee/hub/HubServer.scala with 8 added and 2 removed lines
diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/HubServer.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/HubServer.scala
--- old-smederee/modules/hub/src/main/scala/de/smederee/hub/HubServer.scala	2025-01-31 10:54:04.803764940 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/HubServer.scala	2025-01-31 10:54:04.803764940 +0000
@@ -90,7 +90,8 @@
     } yield key
 
   def run(args: List[String]): IO[ExitCode] = {
-    val databaseMigrator = new DatabaseMigrator[IO]
+    val hubDatabaseMigrator     = new de.smederee.hub.DatabaseMigrator[IO]
+    val ticketsDatabaseMigrator = new de.smederee.tickets.config.DatabaseMigrator[IO]
     for {
       hubConfiguration <- IO(
         ConfigSource
@@ -130,11 +131,16 @@
         case Left(error)    => IO.raiseError(new RuntimeException(error))
         case Right(message) => IO(log.info(message))
       }
-      _ <- databaseMigrator.migrate(
+      _ <- hubDatabaseMigrator.migrate(
         hubConfiguration.database.url,
         hubConfiguration.database.user,
         hubConfiguration.database.pass
       )
+      _ <- ticketsDatabaseMigrator.migrate(
+        ticketsConfiguration.database.url,
+        ticketsConfiguration.database.user,
+        ticketsConfiguration.database.pass
+      )
       transactor = Transactor.fromDriverManager[IO](
         hubConfiguration.database.driver,
         hubConfiguration.database.url,