Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8389037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:36:48+00:00 2026-06-09T18:36:48+00:00

I am about to perform database migrations in MVC .NET. I was wondering how

  • 0

I am about to perform database migrations in MVC .NET. I was wondering how can I unit test this.

For example, I would like to apply the migration in this question: Rename a db column. How could I unit test this?


My thoughts:

  1. Migrate all existing migrations, except my latest one which I am going to test
  2. Add data to the context
  3. Apply new migration
  4. Test data still there

If my thoughts makes sense, any idea how to apply these to MVC .NET? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:36:50+00:00Added an answer on June 9, 2026 at 6:36 pm

    For integration test. Just my rough idea. Probably depends on your environment – build server, DB server, deployment making, …

    You have to always have same (known) starting point with database. Either you’ll create it manually and commit it into VCS and always manually update to M-1 (M=migration). Or just suppose all the migrations M-1 worked before (because it was tested) and create it automatically using i.e. migrate.exe. Then you try to do your steps and then test, preferably using different “channel” than EF, that the data is there, that the column is there etc. Just pure SQL through good old ADO.NET is enough here. Because it doesn’t need to be versatile, you can create some simple helper(s) that will run the query using the well known Connection-Command-Reader path and return it as a raw data i.e. simple IEnumerable (I did that myself, through dynamic to make super simple.).

    My advice is just to keep it simple, nothing fancy and clever. It’s just to support testing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large 100mb file which I would like to perform about 5000
How would I go about setting a link to perform certain functions like hide
In a C++ application that can use just about any relational database, what would
Background I'm sketching on an application that needs to perform something like this database
I have ~25.000 distinct names in an SQL database, and would like to perform
How would I go about drawing a view offscreen in order to perform some
I'd like to host a personal database for about 500 people (1 database per
How can I perform this query on whatever way: delete from sys.tables where is_ms_shipped
I don't know much about database optimization, but I'm trying to understand this case.
I need to perform update/insert simultaneously changing structure of incoming data. Think about Shops

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.