Summary
In this chapter, we constructed a development environment where our app could interact with the database using Docker. Once we did this, we explored the listing of containers and images to inspect how our system is going. We then created migrations using the diesel
crate. After this, we installed the diesel
client and defined the database URL as an environment variable so that our Rust app and migrations could directly connect with the database container.
We then ran migrations and defined the SQL scripts that would fire when the migration ran, and in turn, ran them. Once all this was done, we inspected the database container again to see whether the migration had, in fact, been executed. We then defined the data models in Rust, and refactored our API endpoints, so they performed get
, edit
, create
, and delete
operations on the database in order to keep track of the to-do items.
What we have done here is upgraded our database storage system. We are one step closer to having...