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

  • Home
  • SEARCH
  • 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 9021617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:17:52+00:00 2026-06-16T05:17:52+00:00

I am using EF migrations in my application with SQL Azure database. It was

  • 0

I am using EF migrations in my application with SQL Azure database. It was working fine until I manually dropped a table in SQL Azure. Now when I publish my application that dropped table is not created in SQL Azure. This is the error I get.

Cannot find the object "dbo.TableName" because it does not exist 
or you do not have permissions.

I feel like I created some inconsistency between the database and my model.

I am using Automatic migrations.

  • 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-16T05:17:54+00:00Added an answer on June 16, 2026 at 5:17 am

    Why did you delete the table to begin with? Do you want it to be re-created?

    Before we get into the trickier solutions have you tried using the -TargetMigration option to roll back to the migration just before the one that has your table create in it? I have a feeling you will get SQL errors about trying to delete a table or index of fk that isn’t there, but it’s worth a shot. You can do this by using this command update-database -TargetMigration YourOldMigration. This will roll back all the migrations that were applied after your target migration by running the commands found in the Down() methods of your migration files. If you are getting SQL errors you could try modifying the contents the Down() methods to avoid the errors. Careful. This may result in data loss. If EF warns you about this and you don’t care. Try adding -Force to the end your command.

    Alternatively and additionally….

    Your migrations aren’t just calculated by comparing your db scheme to your dbcontext/models. If you open your sql azure database in sql server management studio you should see a table called __MigrationHistory. It stores all the migrations that have been applied to your db through automatic migrations.

    Please read all the way through before starting. There are some factors that you will want to consider before jumping in. Assuming you didn’t already manipulate this you should be able to find a row for the change set that originally created your table. Delete that row. Now EF automatic migrations will think that that change has not been applied to your DB yet. If you run update-database it should try and re-run it.

    If you had other changes in that migration file it will try and re-run those too. This can cause all sorts of sql errors. You will probably want to manually roll back all the changes that were also part of that migration. Worried about data loss? Try copying data into a manually created table to store until after you are finished. After you get the migration to work you can copy the data back into your new tables/columns.

    Double alternative. If you aren’t too far into development and you don’t have too many concerns about data loss it may just be easier to drop the entire database and let automatic migrations re-create it from scratch.

    Hope that gets you there

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

Sidebar

Related Questions

I'm using South to handle migrations for my application. Everything is working fine however
I have created a new application using Entity Framework 4.3 database migrations. The migrations
I'm using Migrator.NET to write database migrations for the application. Marc-André Cournoyer wrote: Like
I have a MySQL database that I am migrating to SQL Server. The application
I'm writing migrations in Rails 3.2 using SQL (i.e. execute ) to enforce application
I'm using EF 4.3.1 Code First Migrations. I have a table like: public class
I am working on a rails application, and I am using Sqlite in my
I'm using rails 3, and began my application with ActiveRecord. Now, I have many
I developed an application using Entity Framework 4.1 and SQL Server CE 4.0. The
We have an old application that reads in SQL text files and sends them

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.