How to enable migration in SQLite using EF

10,984

Solution 1

There are some implementations of migration for SQLite.

https://github.com/bubibubi/db2ef6migrations is based on the new EF6 migration interface but it has some restrictions. You can download it from Nuget searching for System.Data.SQLite.EF6.Migrations

Solution 2

Unlike MS SQL Server, as default, the free Sqlite driver from system.data.sqlite doesn’t support Migration.So you can’t create a new database from code.You have to manually create it.

For that you can use SQLite Manager add-on for Firefox.

Here is the link : SQLite Manager

Or you can use SQL Server Compact/SQLite Toolbox where @ErikEJ suggested below.

Share:
10,984

Related videos on Youtube

habib
Author by

habib

Hi, This is Habib Ul Rehman I'm a professional and enthusiast programmer, Microsoft Certified Solution Developer, communicator, learner, and software developer having 5+ years experience, especially in .Net technologies. I have good development skills with always the best solutions and in the form of clean and well-documented code. I like to debug code because it makes a lot of fun.

Updated on June 18, 2022

Comments

  • habib
    habib almost 2 years

    I have stuck in problem. I am writing a code for windows desktop application and I have to use sqlite as a database. I have successfully installed system.data.sqlite and entity framework from nuget package. I have also created my DbContext class. Now problem is that as soon as I tried to run my code an exception comes whose inner message is

    {"SQLite Error 1: 'no such table: TimeSheet'"}.

    This means your table TimeSheet does not exist in database. Plz tell me how to create table in sqlite using entity framework or how to enable migrations.

  • ErikEJ
    ErikEJ over 7 years
    Or use the free SQLite Toolbox extension directly in Visual Studio
  • habib
    habib over 7 years
    But brother I have to create database tables from my models. How can I do this?
  • Sampath
    Sampath over 7 years
    Yes,above free driver doesn't support migration.So you have to create it manually by using one of the above tool.No other option.
  • habib
    habib over 6 years
    Its possible by using MicrosoftEntityFramework Core that support sqlite. It works just like entityframework.