Skip to content

Improve usability of SQL init scripts with multiple file support #2232

@mroche89

Description

@mroche89

Context

Issue originally raised on stackoverflow as a question.

It would be useful to be able to initialize a database with multiple startup scripts. In most projects that I've worked on, there are multiple onboarding scripts (database, schema, data, test-data etc). As such, when provisioning a new database using testcontainers for an integration test, it'd be helpful to be able to execute all of these scripts on startup without needing to merge them into a single script.

Suggestion

An additional API in JdbcDatabaseContainer

/**
  * Execute each script in the order of which they're provided
  */
public SELF withInitScript(String... initScriptPaths) {
    // ...
}

An additional consideration for this API might be the result of 2127

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions