Skip to content

SchemaUtils.createIfNotExists disregards configured schema name #614

@PerWiklander

Description

@PerWiklander

Versions used

Akka version: 2.6.16
akka-persistence-jdbc version: 5.0.4

database: Postgresql

Expected Behavior

  1. Create a schema named journal

  2. application.config:

    journal-schema-name = "journal"
    
    jdbc-journal {
      tables.event_journal.schemaName = ${journal-schema-name}
      tables.event_tag.schemaName     = ${journal-schema-name}
    }
    
    jdbc-snapshot-store {
      tables.snapshot.schemaName = ${journal-schema-name}
    }
    
  3. Run SchemaUtils.createIfNotExists()

  4. Tables are created in schema journal

Actual Behavior

  1. Create a schema named journal
  2. application.config as above
  3. Run SchemaUtils.createIfNotExists()
  4. Tables are created in schema public

Comments

Looking a the implementation it is obvious that this fails since the schema is created from a static file:
schema/postgres/postgres-create-schema.sql

Why not use Slick to generate the schema from
akka.persistence.jdbc.journal.dao.JournalTables instead?

FYI: I'm doing this from an SBT task to provide a simpler local dev setup. I have no plans on running SchemaUtils in prod.

EDIT: I was only concerned with the schema here, but this of course applies to all settings like table and column names as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions