PowerSchemaSync 1.2.1

dotnet add package PowerSchemaSync --version 1.2.1
NuGet\Install-Package PowerSchemaSync -Version 1.2.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PowerSchemaSync" Version="1.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PowerSchemaSync --version 1.2.1
#r "nuget: PowerSchemaSync, 1.2.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PowerSchemaSync as a Cake Addin
#addin nuget:?package=PowerSchemaSync&version=1.2.1

// Install PowerSchemaSync as a Cake Tool
#tool nuget:?package=PowerSchemaSync&version=1.2.1

power-schema-sync

Nuget

power-schema-sync is a database structure synchronization tool developed using .Net, which compares the structure of the two databases to generate the SQL required to synchronize the structure, which functions similarly to the structure synchronization in Navicat; The difference is that this project is an open source library that can be directly integrated into your existing system to implement regular synchronization or listen for an event to trigger a synchronization task.

Quick Start

install

dotnet add package PowerSchemaSync

usages

IDataBase dbSoruce = DataBaseFactory.GetDataBase(DataBaseType.MYSQL, "connString1");
IDataBase dbTarget = DataBaseFactory.GetDataBase(DataBaseType.MYSQL, "connString2");

// 1.获取整个库的表结构创建sql
var sqlStructure = dbSoruce.ExportStructure("test");
Console.WriteLine(sqlStructure);

// 2.结构比较获取同步结构的sql
var diff = new DiffUtility(dbSoruce, "test", dbTarget, "test").Diff();

Console.WriteLine("------------新建-----------");
foreach (var sqls in diff.Tables.Where(x => x.Operate == OprateEnum.Created).Select(x => x.SyncSqls))
{
    foreach (var sql in sqls)
    {
        Console.WriteLine(sql);
    }
}

Console.WriteLine("------------删除-----------");
foreach (var sqls in diff.Tables.Where(x => x.Operate == OprateEnum.Delete).Select(x => x.SyncSqls))
{
    foreach (var sql in sqls)
    {
        Console.WriteLine(sql);
    }
}

Console.WriteLine("------------修改-----------");
foreach (var sqls in diff.Tables.Where(x => x.Operate == OprateEnum.Edit).Select(x => x.SyncSqls))
{
    foreach (var sql in sqls)
    {
        Console.WriteLine(sql);
    }
}

Console.ReadLine();

Features

  • table sync
  • column ysnc
  • index ysnc
  • primary ysnc
  • view ysnc
  • func sync
  • stored procedure sync

Supported Databases

  • Mysql
  • MS SqlServer
  • Orecle
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.1 584 7/31/2023
1.1.0 585 7/28/2023
1.0.0 565 7/22/2023