Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker prod build #2

Open
ghotiphud opened this issue Aug 16, 2017 · 2 comments
Open

Docker prod build #2

ghotiphud opened this issue Aug 16, 2017 · 2 comments

Comments

@ghotiphud
Copy link
Owner

See comments here: https://www.reddit.com/r/rust/comments/6u27xp/my_dockerized_rocket_diesel_and_react_starter/

Multi-stage build + diesel embed_migrations!()
(http://docs.diesel.rs/diesel/macro.embed_migrations.html) is probably the way to go.

Alpine + musl??

ghotiphud pushed a commit that referenced this issue Jul 18, 2018
@nmrshll
Copy link

nmrshll commented Dec 26, 2018

@ghotiphud link to embed_migrations is now broken.

Also, an example as to how to use embed_migrations would be super useful if you already have a clue how to ! It's not easy yet to find anything on the web about how to use that properly

@ghotiphud
Copy link
Owner Author

ghotiphud commented Jan 7, 2019

Well, here's the updated link: https://docs.rs/diesel/0.16.0/diesel/macro.embed_migrations.html

The basic usage is

embed_migrations!("../migrations/sqlite");

fn main() {
    let connection = establish_connection();

    // This will run the necessary migrations.
    embedded_migrations::run(&connection);

    // By default the output is thrown out. If you want to redirect it to stdout, you
    // should call embedded_migrations::run_with_output.
    embedded_migrations::run_with_output(&connection, &mut std::io::stdout());
}

which as far as I know, basically does an include_str!() (https://doc.rust-lang.org/std/macro.include_str.html) for all the files in your migrations directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants