question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to disable migrations for existing databases

See original GitHub issue

How do you disable migrations for existing databases in code?

Previously I used this in the DbContext constructor: Database.SetInitializer<ApplicationDbContext>(null);

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
bricelamcommented, Sep 16, 2015

EF7 will never automatically create or alter your database schema. Users will need to explicitly call one of the following to do that.

context.Database.EnsureCreated();
context.Database.Migrate();
0reactions
Seabizkitcommented, Jan 22, 2020

@sheinema could you share how you have urs setup, as if i dont create migrations, when i say update database, it just creates it blank instead of creating tables.

Read more comments on GitHub >

github_iconTop Results From Across the Web

entity framework - How can I disable code first migrations
You need to go to Management Studio, open your database tables, go to System Tables folder and remove __MigrationHistory table that is located ......
Read more >
How can I disable migrations in the second database ...
Well first of all, don't run `db:drop` in a production environment. Secondly, after defining multiple databases, you can use the `rails db:< ...
Read more >
Code First Migrations with an existing database - EF6
Code First Migrations with an existing database · Step 1: Create a model · Step 2: Enable Migrations · Step 3: Add an...
Read more >
Resetting Entity Framework Migrations to a clean Slate
Removing and Resetting Migrations · Remove the _MigrationHistory table from the Database · Remove the individual migration files in your project's ...
Read more >
how to disable migration entity framework
The easiest is to disable the initializer by Setting it null for a given context type. ... Database.SetInitializer<YourContext>(null); An easy ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found