fission-codes / fission-server

Apache License 2.0
9 stars 0 forks source link

Run database migrations from distributed binary #254

Open walkah opened 8 months ago

walkah commented 8 months ago

Summary

Problem

Unless I'm mistaken, we currently need a clone of the repo / source to run the diesel migrations. It looks, though, like we're embedding the migrations in the binary - but I can't see any way to trigger them.

Impact

Need source to run migrations (can't just use the distributed binary).

Solution

I don't know enough about diesel, but it looks like automigrations are a possibility (should be the simplest, near term solution).

matheus23 commented 8 months ago

We already run migrations inside the binary for test purposes (because they're stood up on-the-fly), here: https://github.com/fission-codes/fission-server/blob/53ffd0c1012e605341ed559c64c47b52d5ddfb69/fission-server/src/test_utils/ephermeral_db.rs#L22-L29

We need to make that code invokable from the binary CLI, too.

I'm pretty sure that actually embeds the migrations in the binary, given this: https://github.com/fission-codes/fission-server/blob/53ffd0c1012e605341ed559c64c47b52d5ddfb69/fission-server/src/db/mod.rs#L9-L12

So I'm 90% sure that's an easy task.