immich icon indicating copy to clipboard operation
immich copied to clipboard

feat(server): env variable to skip migrations on startup

Open mertalev opened this issue 10 months ago • 4 comments

Description

Some deployment methods, like Portainer and TrueNAS SCALE, make it difficult to start the database without starting everything else as well. This makes it awkward to restore from a backup as the server will run migrations that then cause duplicate key violations, etc.

This PR adds an env variable to ease this process, skipping migrations to allow the admin to restore to a clean database.

mertalev avatar Apr 25 '24 00:04 mertalev

Deploying immich with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8d4d2b5
Status: ✅  Deploy successful!
Preview URL: https://a72a8ba7.immich.pages.dev
Branch Preview URL: https://feat-skip-migrations.immich.pages.dev

View logs

Ty. Can we update line 76 in backup and restore which states "When DB_URL is defined, the other database (DB_*) variables are ignored, with the exception of DB_VECTOR_EXTENSION." The same note is in the pre existing Postgres docs.

mmomjian avatar Apr 25 '24 00:04 mmomjian

Ty. Can we update line 76 in backup and restore which states "When DB_URL is defined, the other database (DB_*) variables are ignored, with the exception of DB_VECTOR_EXTENSION." The same note is in the pre existing Postgres docs.

Good catch! I changed it to just list the relevant variables so it won't get outdated as more variables are added.

mertalev avatar Apr 25 '24 00:04 mertalev

Ty. Can we update line 76 in backup and restore which states "When DB_URL is defined, the other database (DB_*) variables are ignored, with the exception of DB_VECTOR_EXTENSION." The same note is in the pre existing Postgres docs.

Good catch! I changed it to just list the relevant variables so it won't get outdated as more variables are added.

Ty! I misspoke its also on line 76 of env vars docs that also contains the same language. I like switching to explicitly saying which ones are ignored.

mmomjian avatar Apr 25 '24 00:04 mmomjian