I’m building an expense tracker app, and live streaming the whole process! This blog series is a written form of each livestream.
FINALLY SOME CODING! 😍
I started creating the migrations for the different tables. I had to reference the Vapor docs pretty frequently to properly make the primary and foreign key relationships.
Migrations are like a version control system for your database. Each migration defines a change to the database and how to undo it. By modifying your database through migrations, you create a consistent, testable, and shareable way to evolve your databases over time.Vapor docs – Migrations
I created migrations for:
- Category Type
- an enum for income / expenses, to make everything type-safe
I ended up changing the data type for how I’m saving currency. I’ll use a string for the currency’s denomination and an integer for the amount. Right now, I’ll most likely make it so that the user sets the currency once and can’t change it, but I may change that later.