Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aronium/migration
Database migration tool for SQL Server and SQLite written in C#
https://github.com/aronium/migration
chsarp database database-migrations dotnet sql-server sqlite sqlite-database
Last synced: 23 days ago
JSON representation
Database migration tool for SQL Server and SQLite written in C#
- Host: GitHub
- URL: https://github.com/aronium/migration
- Owner: aronium
- Created: 2016-03-21T21:31:19.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2021-10-09T16:38:26.000Z (over 3 years ago)
- Last Synced: 2024-11-15T18:21:14.918Z (3 months ago)
- Topics: chsarp, database, database-migrations, dotnet, sql-server, sqlite, sqlite-database
- Language: C#
- Homepage:
- Size: 68.4 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Aronium Migration
Aronium.Migration is a console application written in C# used for managing migrations for SQL Server and SQLite databases.
It uses similar commands as [MyBatis Migrations](http://www.mybatis.org/migrations/)
* `bootstrap` - Initializes database configuration
* `status` - Gets the migrations status
* `new` - Creates new migration script
* `up` - Executes new migration scripts
* `pending` - Runs all non executed migration scripts
* `help` - Displays helpCommands without additional parameters can be executed with command name only, while commands that contains parameters must be executed with leading minus sign (-).
**IMPORTANT:** *bootstrap* command must be executed before other commands so database credentials and properties are set properly.
Note that *Aronium.Migration.SQLite* uses shared files from *Aronium.Migration* project, added as linked files.
## Usage
Before executing any command from console, navigate to directory containing `migration.exe` or specifiy its full path.
#### Bootstrap command
```
> migration bootstrap
```
*SQL Server*Executing `bootstrap` command will ask for a server and credentials to use.
Follow the instructions to define connection parameters like server name, database and user credentials. Once you have entered your credentials and server properties, they will be saved in "migration.properties" file, and can be used when required.You can also use input parameters to provide database connection properties without a config file, as follows:
```
-server SERVER_NAME -database DATABASE_NAME -username USERNAME -password PASSWORD
```*SQLite*
Executing `bootstrap` command will ask for a database file (SQLite database)
> Database file:
Write file name or a full path to your SQLite database
> Selected file: C:\\...\demo.sqlite
>
> Specified file do not exists. Do you want to create new database file? Y/NIf you press `Y`, SQLite database will be automatically created on specified location.
#### New command
```
> migration -new "My First Migration Script"
```
This command will output the result as:
> New script added. Path: C:\\...\Migrations\Scripts\1_0__My_First_Migration_Script.sql**Make sure you execute "new" command with leading minus sign before command name, eg. *-new "script file name"*, so file name is parsed correctly**
If leading minus sign is ommited, you will be asked to enter file name again.
Running "new" command without specified version name will add new file with major version automatically generated.
#### Status command
```
> migration status
```
This command will output current migration status with executed and pending migration scripts.#### Up command
```
> migration up
```
Running `up` command will apply newer migrations then the current version.#### Pending command
```
> migration pending
```
Running `pending` command will execute all pending migrations.