Skip to content

Make sqlx::test not take minutes to run migrations every time #4133

@CodingAnarchy

Description

@CodingAnarchy

I have found these related issues/pull requests

Relates to #4131

Description

Migrations in a production application take a progressively large amount of time to run, and this is multiplied by the number of tests as the migrations run for each test case. In even a relatively small application with a few dozen migrations this could push individual sqlx::test invocations into taking 60+ seconds each, causing timeouts and test suites that, even when parallelized, can take an inordinately long time to complete.

Prefered solution

Templating the database with schema migrations already run can allow for copying that database structure into the test database, which would be significantly faster when many migrations exist.

Is this a breaking change? Why or why not?

This can be implemented with an opt-out, either as an optional feature or with a command line flag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions