Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,24 @@
</p>

## 📕 How to use


1. Install Dotnet (net5/net6). `ChangeDB` is supported by dotnet sdk, please check the link [Here](https://dotnet.microsoft.com/download/dotnet) to setup your personal dotnet sdk.
1. Install ChangeDB tool. you can follow the command below to setup tool quite easily.
1. Install Dotnet (net5/net6):
`ChangeDB` is supported by dotnet SDK, please check the link [Here](https://dotnet.microsoft.com/download/dotnet) to set up your dotnet SDK.
2. Install `ChangeDB`:
Follow the command below to set up the tool quite easily.
```shell
dotnet tool install ChangeDB.ConsoleApp -g
```
1. 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.
3. Convert Database:
`changedb migration` is the command to migrate the database. Like the example command below, you need to provide the source database type, source database connection string, target database type, and target database connection string to establish migrate task. and for the target database, `changedb` can create a new target database even if not exists. so you don't create an empty database every time first.
```shell
changedb migration {source-database-type} "{source-connection-string}" {target-database-type} "{target-connection-string}"
```
1. 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.
4. Dump database to sql scripts:
`changedb dumpsql` is the command to generate a dump file, the example below to create SQL scripts.
```shell
changedb dumpsql {source-database-type} "{source-connection-string}" {target-database-type} "{output-file}"
```
1. Here we use [Northwind.sql](https://github.com/Microsoft/sql-server-samples/tree/master/samples/databases/northwind-pubs) as source data to show how we migrate between different type of database
5. Here we use [Northwind.sql](https://github.com/Microsoft/sql-server-samples/tree/master/samples/databases/northwind-pubs) as source data to show how `ChangeDB` migrate between different types of database
<p align="center">
<img alt="build" src="./res/ChangedbDemo.gif" />

Expand All @@ -43,6 +45,7 @@
- **Sql Server**
- **Postgres**
- **Mysql**
- **Firebird**
- **Sql Server Compact** (only supported in windows)

## 🏗️Architecture diagram
Expand All @@ -54,9 +57,10 @@

|Database | Format connection string | Extend usages |
|---|---|---|
|Sql Serve| `Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;` |[Link](https://www.connectionstrings.com/microsoft-data-sqlclient/) |
|Sql Server| `Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;` |[Link](https://www.connectionstrings.com/microsoft-data-sqlclient/) |
|Postgres| `Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername;Password=myPassword;` |[Link](https://www.connectionstrings.com/npgsql/) |
|Mysql| `Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;` |[Link](https://www.connectionstrings.com/mysql-connector-net-mysqlconnection/) |
|Firebird| `User=SYSDBA;Password=masterkey;Database=SampleDatabase.fdb;DataSource=localhost;Port=3050;Dialect=3;Charset=NONE;Role=;Connection lifetime=15;Pooling=true;MinPoolSize=0;MaxPoolSize=50;Packet Size=8192;ServerType=0;` |[Link](https://www.connectionstrings.com/firebird/) |
|Sql Server Compact| `Data Source=MyData.sdf;Persist Security Info=False;` |[Link](https://www.connectionstrings.com/sqlserverce-sqlceconnection/)|

## 🧩Database Object Supported
Expand All @@ -69,6 +73,3 @@
| Table|`default function value`|✔️(`newid`,`getdate`)|✔️(`gen_random_uuid`,`now`)|✔️(`uuid`,`now`)|✔️(`newid`,`getdate`)|
| Table|`foreign key`|✔️|✔️|✔️|✔️|
| Table|`unique index`|✔️|✔️|✔️|✔️|