playframework / playframework/play-slick

DefaultSlickApi is unsuitable for running offline evolutions

Open
#425 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status:backlog
Dominant language
Scala
Stars
794
Forks
272
Avg merge
1d 8h
Merged PRs (30d)
17

Description

NB: Offline evolutions are those without a running application.

Currently DefaultSlickApi has two dependencies that are hard to satisfy in a non-application context: environment: Environment and lifecycle: ApplicationLifecycle.

environment is a bogus dependency; it is unused, and should be dropped.

lifecycle implements behavior that is pretty easy to ignore if there's no lifecycle - just don't add the stop hooks. This dependency should either be made into a Option[ApplicationLifecycle] (don't know if that's doable with generic javax.inject) for both DefaultSlickApi and DatabaseConfigFactory; or, DefaultSlickApi/DatabaseConfigFactory should extend an OfflineSlickApi does the same thing but without the stop hook. In this case, the user would need some other way to initiate a shutdown.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting DefaultSlickApi and DatabaseConfigFactory, focusing on the unused environment dependency and the lifecycle stop hooks. Determine how offline evolutions instantiate these components and choose how lifecycle-free use should work. Done means offline evolutions can use the APIs without a running application while preserving shutdown behavior for normal use.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
backend, databases
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.