/changedb

Primary LanguageC#MIT LicenseMIT

CHANGEDB

ChangeDB is a multi-database cli convert tool, it's all about making database migration much more easier.

build Nuget GitHub codecov Security Rating

📕 How to use

  1. Install Dotnet (net5/net6). ChangeDB is supported by dotnet sdk, please check the link Here to setup your personal dotnet sdk.
  2. Install ChangeDB tool. you can follow the command below to setup tool quite easily.
    dotnet tool install ChangeDB.ConsoleApp -g
  3. Database converting. you can use changedb migration command convert database. Like the example command below, you need to provide source database type, source database connection string, target database type and target database connection string to establish migrate task. and for target database, changedb tool has the ability to create a new target database even if not exists. so you don't create a empty database everytime first.
    changedb migration {source-database-type} "{source-connection-string}" {target-database-type} "{target-connection-string}" 
  4. Dump database to sql scripts, changedb tool also has the ability to generate sql scripts. you can use changedb dumpsql command,Like the example example below to create sql scripts.
    changedb dumpsql {source-database-type} "{source-connection-string}" {target-database-type} "{output-file}" 
  5. Here we use Northwind.sql as source data to show how we migrate between different type of database

build

📦 Supported Database

  • Sql Server
  • Postgres
  • Mysql
  • Sql Server Compact (only supported in windows)

🏗️Architecture diagram

build

🔗Database Formate Connection String

Database Format connection string Extend usages
Sql Serve Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword; Link
Postgres Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername;Password=myPassword; Link
Mysql Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword; Link
Sql Server Compact Data Source=MyData.sdf;Persist Security Info=False; Link

🧩Database Object Supported

Category Object Sql Server Postgres Mysql Sql Server Compact
Table identity ✔️ ✔️ ✔️ ✔️
Table index ✔️ ✔️ ✔️ ✔️
Table unique ✔️ ✔️ ✔️ ✔️
Table default constant value ✔️ ✔️ ✔️ ✔️
Table default function value ✔️(newid,getdate) ✔️(gen_random_uuid,now) ✔️(uuid,now) ✔️(newid,getdate)
Table foreign key ✔️ ✔️ ✔️ ✔️
Table unique index ✔️ ✔️ ✔️ ✔️