PharmaStock: Backend Infrastructure & Database Connectivity
This week marked the transition from planning and design into real backend development. After organizing the project structure and defining use cases in previous weeks, I focused on building the technical foundation that the rest of the application will depend on.
The primary goal was completing SCRUM-16, which involved connecting the ASP.NET Core backend API to a MySQL database and verifying that the system could successfully generate and manage database tables.
I began by configuring MySQL to run inside a Docker container. Using Docker ensures that every developer on the team works against the same database environment, which reduces setup inconsistencies and avoids the common “it works on my machine” problem. Once the container was running correctly, I verified that it could be started, stopped, and inspected reliably.
Next, I integrated Entity Framework Core with the Pomelo MySQL provider and registered the DbContext within the application. This step allows the backend to map C# entity models directly to database tables. Instead of manually creating SQL tables, the system now uses migrations to keep the database schema aligned with the codebase.
To confirm everything was working correctly, I created a test entity and generated a migration. After running the database update command, the tables were successfully created inside the Docker container. This verified that:
-
The API can connect to MySQL
-
Migrations execute correctly
-
Tables are generated from entity models
-
Database versioning is functioning
Although no visible features were added this week, this was a critical milestone. A stable infrastructure layer is necessary before implementing real schema design, authentication, or API endpoints.
With the database connection verified and migrations working properly, the backend is now ready for SCRUM-26, which will focus on finalizing the Medication and Inventory schema design.
This week was less about building features and more about building stability. With the foundation now in place, development can move forward with confidence.
Comments
Post a Comment