Skip to content

Latest commit

 

History

History
63 lines (43 loc) · 1.89 KB

dbGuide.md

File metadata and controls

63 lines (43 loc) · 1.89 KB

Project Development Guide

This guide covers the full workflow for local database setup, Git branching, and creating Entity Framework migrations. Following these steps will help prevent conflicts and maintain a clean project history.


Apply All Existing Migrations:

Create the database and apply all existing migrations.

dotnet ef database update

2. Syncing Your Branch and Creating a Migration

Follow this process before you create a new migration to ensure your branch is up-to-date with the main branch. This is the standard workflow to prevent conflicts.

  1. Commit Your Current Work: Make sure any changes on your feature branch are committed.

    git add .
    git commit -m "Your work-in-progress commit message"
  2. Sync with the main Branch:

    • Switch to main and pull the latest changes.
      git checkout main
      git pull origin main
    • Switch back to your feature branch and rebase it on top of main.
      git checkout your-feature-branch
      git rebase main
  3. Apply Your Team's Migrations: After rebasing, your project might now include new migrations from your teammates. Apply them to your local database.

    dotnet ef database update
  4. Create Your New Migration: Now that your local database is synced with the latest schema, you can safely create your own migration.

    dotnet ef migrations add <DescriptiveMigrationName>
  5. Commit the New Migration: The previous command created new files. You must add and commit them.

    git add .
    git commit -m "feat: Add migration for <DescriptiveMigrationName>"
  6. Apply Your Own Migration: (Optional but recommended) Test your new migration by applying it to your local database.

    dotnet ef database update