https://github.com/andersnm/mysqldiff
https://github.com/andersnm/mysqldiff
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/andersnm/mysqldiff
- Owner: andersnm
- Created: 2020-05-20T05:39:11.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-20T05:44:54.000Z (about 6 years ago)
- Last Synced: 2025-01-20T07:09:41.154Z (over 1 year ago)
- Language: C#
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MySqlDiff.CliTool - dotnet mysqldiff
**EXPERIMENTAL** Database diffing and migration tool for MySQL.
## Project format
The tool operates on a project directory structure like this:
```
/tables
/*.sql
/triggers
/*.sql
/procedures
/*.sql
/seeds
/*.sql
```
Users maintain the database schema and seeds by writing plain CREATE TABLE, CREATE PROCEDURE, CREATE TRIGGER, INSERT statements in SQL files under the `tables`, `triggers`, `procedures` and `seeds` directories.
The tool parses the database structure from these files, compares with a live database instance, and generates SQL to migrate the schema.
## Commands
```
dotnet mysqldiff diff --source ... --target ...
dotnet mysqldiff copy --source ... --output ...
```
### diff
Compares two projects and generates SQL with the difference. Can be used to generate both up and down migration scripts by reversing the source and target arguments.
```
Options:
--source fs, db or null
--source-fs-path Project directory. Only used with --source fs
--source-db-cs MySQL connection string. Only used with --source db
--target fs, db or null
--target-fs-path Project directory. Only used with --target fs
--target-db-cs MySQL connection string. Only used with --target db
```
The 'null' source or target type specifies an empty project, which thusly generates SQL to create or delete the entire database.
### copy
Reads a project and saves it to the file syste. Can be used to export an initial project from a live database instance.
```
--source fs, db or null
--source-fs-path Project directory. Only used with --source fs
--source-db-cs MySQL connection string. Only used with --source db
--output Where to save the output
```