Mimetis / Dotmim.Sync

A brand new database synchronization framework, multi platform, multi databases, developed on top of .Net Standard 2.0. https://dotmimsync.readthedocs.io/
MIT License
876 stars 187 forks source link

Provider.Provision/Deprovision methods not supported on Sqlite #125

Closed gb0o closed 4 years ago

gb0o commented 5 years ago

Recently attempted to use the Provision/Deprovision methods on a Sqlite db. Got SyncException caused by returning null from IDbManagerTable.CreateManagerTable(...):

using Dotmim.Sync.Manager;
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.Common;

namespace Dotmim.Sync.Sqlite
{
    public class SqliteManager : DbManager
    {
        public SqliteManager(string tableName) : base(tableName)
        {

        }

        public override IDbManagerTable CreateManagerTable(DbConnection connection, DbTransaction transaction = null)
        {
            // TODO : works with PRAGMA table_info('TableNAme');
            Console.WriteLine("At this time, Sqlite does not support getting table structure from Sqlite metadatas");
            return null;
        }
    }
}

Obviously missing some implementation here. How hard would it be to implement the IDbManagerTable interface for Sqlite? Use PRAGMA table_info('TableName')?.

Mimetis commented 5 years ago

Yep. I didn't do the IDbManagerTable stuff on SQLite because it's not supposed to be a server provider. As you mention then, the Provision and Deprovision don't work so far.

Will add it to my todo list, but don't expect it soon :)

Seb

gb0o commented 5 years ago

I am using SQLite as a client provider and was hoping I could use the Provision, Deprovision commands to manage database migration on client machines. The work flow would be:

  1. Download a new version of the client application
  2. Deprovision tracking tables etc
  3. Apply Entity Framework migrations (converted from SQL Server to SQLite)
  4. Provision the tracking tables etc
  5. App ready to use.

Thinking about this more Provision, Deprovision will not work well anyway because the entire local database will have to be re-synced and cause performance issues. Will probably be better to just reseed the database by downloading a new version to the client.

Mimetis commented 4 years ago

Worked in v0.4