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 9231467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:04:33+00:00 2026-06-18T06:04:33+00:00

In a newly created MVC4 web project, I delete a table in the Server

  • 0

In a newly created MVC4 web project, I delete a table in the Server Explorer (DataConnections…. with Mouse’s Right Click), then in the Package Manager Console (PMC) I run

update-database -verbose -force

to generate a new table of the same name in the same database. But the PMC only tries out “ALTER” command which is not what I would want it to do and it outputs an error

Cannot find the object “dbo.UserProfile” because it does not exist or
you do not have permissions.

How can it fix this now ?

UPDATE

Here is the data model of the class UserProfile

public class UserProfile
{
    [Key]
    [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
    public int UserId { get; set; }
    public string UserName { get; set; }
    public string UserEmail { get; set; }
    [DefaultValue(false)]
    public bool IsActivated { get; set; }        
}

And here is the code to initialize the table in the Seed method of the Configuration file

    WebSecurity.CreateUserAndAccount("Administrator", "admin",
                new
                {                        
                    UserEmail = "admin@gmail.com",
                    IsActivated=true

                }                   
                );
  • 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-18T06:04:34+00:00Added an answer on June 18, 2026 at 6:04 am

    EF Migrations expects that either you are in charge (you can use the -Script option to have Migrations generate scripts rather than run DDL directly), or that it is in charge. Mixing and matching does not work.

    If you know the structure of UserProfile (perhaps you saved a script?) you can manually re-create it as it was before your change, then allow EF Migrations to apply the migration again.

    If you have an appropriate backup of the database, restore that and retry.

    If not, you can drop and re-create the database, then do an initial migration.

    Personally I always have EF Migrations script the migrations (-Script option). I then apply the script myself. That way, I have everything I need to do a controlled migration in QA and PROD environments. I just don’t have enough trust in EF Migrations to let it auto migrate production data (not that Migrations is bad, but a minor bug could wipe out production data. Not a risk I’m willing to take.)

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

Sidebar

Related Questions

I am learning a newly created default simple MVC4 web project. In the index
Servlet not working in newly created Dynamic Web Project in Eclipse Juno for Java
In a newly created MVC4 project'd database tables, I don't know how can I
I have this problem getting my newly created php project on Netbeans work on
In a newly created Django project I'm using ropemacs to get semantic completions and
Symptoms I have newly created setup package (MSI) that installs a new version of
I just added a newly created SP to my project which unfortunately required a
While importing a dump into a newly created database, the server stopped with the
How to commit a newly created project in branch. I tried it, but it
I created a project using the newly Single page application of Asp.Net MVC 4.

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.