Deployment #28

Closed
opened 2024-09-06 16:12:52 +00:00 by matous-volf · 0 comments
matous-volf commented 2024-09-06 16:12:52 +00:00 (Migrated from github.com)

From https://diesel.rs/guides/getting-started:

When preparing your app for use in production, you may want to run your migrations during the application’s initialization phase. You may also want to include the migration scripts as a part of your code, to avoid having to copy them to your deployment location/image etc.

The diesel_migrations crate provides the embed_migrations! macro, allowing you to embed migration scripts in the final binary. Once your code uses it, you can simply include connection.run_pending_migrations(MIGRATIONS) at the start of your main function to run migrations every time the application starts.

From https://diesel.rs/guides/getting-started: > When preparing your app for use in production, you may want to run your migrations during the application’s initialization phase. You may also want to include the migration scripts as a part of your code, to avoid having to copy them to your deployment location/image etc. > > The [diesel_migrations](https://docs.rs/crate/diesel_migrations/2.2.0) crate provides the [embed_migrations!](https://docs.rs/diesel_migrations/2.2.0/diesel_migrations/macro.embed_migrations.html) macro, allowing you to embed migration scripts in the final binary. Once your code uses it, you can simply include connection.run_pending_migrations(MIGRATIONS) at the start of your main function to run migrations every time the application starts.
Sign in to join this conversation.
No project
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: matous-volf/todo-baggins#28
No description provided.