lemmy icon indicating copy to clipboard operation
lemmy copied to clipboard

Allow migrations to be run outside of the server startup

Open tbe opened this issue 1 year ago • 2 comments

Requirements

  • [X] Is this a feature request? For questions or discussions use https://lemmy.ml/c/lemmy_support
  • [X] Did you check to see if this issue already exists?
  • [X] Is this only a feature request? Do not put multiple feature requests in one issue.
  • [X] Is this a UI / front end issue? Use the lemmy-ui repo.

Is your proposal related to a problem?

Currently, the Lemmy server runs migrations as part of the startup process. This requires the application user to have matching privileges on the database.

From a security point of view, the application should only have the minimum set of privileges, required at runtime.

Describe the solution you'd like.

Providing a flag, to disable migrations and a tool to either run the migrations with a different set of user/password, or to dump the SQL that would be executed and leave it to the user, would mitigate this issue

Describe alternatives you've considered.

Currently, migrations could be run by hand, but this is error prone, and can lead to missing migrations.

Additional context

No response

tbe avatar Jun 22 '23 15:06 tbe

You can use Diesel's CLI to run migrations using diesel migration run. Just have to configure the --database-url.

kartikynwa avatar Jun 22 '23 15:06 kartikynwa

You can use Diesel's CLI to run migrations using diesel migration run. Just have to configure the --database-url.

Great, didn't see that. Then, the only missing part is a flag to disable migrations during startup.

tbe avatar Jun 22 '23 15:06 tbe

Lemmy can't run without these migrations being set up as a minimum.

dessalines avatar Oct 18 '23 22:10 dessalines