Migrondi.Core
1.0.0-beta-011
dotnet add package Migrondi.Core --version 1.0.0-beta-011
NuGet\Install-Package Migrondi.Core -Version 1.0.0-beta-011
<PackageReference Include="Migrondi.Core" Version="1.0.0-beta-011" />
paket add Migrondi.Core --version 1.0.0-beta-011
#r "nuget: Migrondi.Core, 1.0.0-beta-011"
// Install Migrondi.Core as a Cake Addin #addin nuget:?package=Migrondi.Core&version=1.0.0-beta-011&prerelease // Install Migrondi.Core as a Cake Tool #tool nuget:?package=Migrondi.Core&version=1.0.0-beta-011&prerelease
Currently Working on the next version to also add better support for the VSCode Extension!
Migrondi
Migrondi is a SQL Migrations tool designed to be simple and execute simple migrations. Write SQL and execute SQL against your database.
No need to install it, use it from VSCode! https://github.com/AngelMunoz/migrondi-vscode
Migrondi Runs on Linux-x64
, Linux-arm64
, Windows-x64
, and MacOS-x64
(intel based)
Install
For Non .NET users
Grab the binary from the releases page or build from source and put it on your PATH
, that way the command is available globally e.g.
# you can put this at the end of your ~/.bashrc
# $HOME/Apps/migrondi is a directory where you have downloaded your "Migrondi" binary
export MIGRONDI_HOME="$HOME/Apps/migrondi"
export PATH="$PATH:$MIGRONDI_HOME"
For .NET users
you can now install this as a global/local tool as well
dotnet tool install --global Migrondi
Usage
Init
If you are starting from scratch you can run the init command to create the migrondi files and directories needed for the rest of the commands to work properly
~/Migrondi $ ./Migrondi init
Created /home/x/Migrondi/migrondi.json and /home/x/Migrondi/migrations
~/Migrondi $
PS C:\Users\x\Migrondi> ./Migrondi.exe init
Created C:\Users\x\Migrondi\migrondi.json and C:\Users\x\Migrondi\migrations\
PS C:\Users\x\Migrondi>
Then you can adapt the configuration as needed
Config File
to use this tool you need to supply a JSON configuration file (the name must be migrondi.json
)
{
"connection": "Data Source=Migrondi.db",
"migrationsDir": "./migrations/",
"driver": "sqlite"
}
connection
This is a IDbConnection compatible connection string (you can find examples in the follwing links)
migrationsDir
this is an absolute or relative path to where the migrations will be stored Note: please include the trailing slash to prevent writing on the directory above of the one you pointed to. (if you use the init command, this is created for you)
driver
any of the following "mssql" "sqlite" "mysql" "postgres"
Migrondi 0.5.0
Copyright (C) 2020 Angel D. Munoz
init Creates basic files and directories to start using migrondi.
new Creates a new Migration file.
up Runs the migrations against the database.
down Rolls back migrations from the database.
list List the amount of migrations in the database.
help Display more information on a specific command.
version Display version information.
New
To create a new migration file run Migrondi.exe new -n CreateTodosTable
where CreateTodosTable
is the name of your migration, you can replace that name with your migration name it will create a new file with a name like this:
SampleMigration_1586550686936.sql
with the following contents
-- ---------- MIGRONDI:UP:1586550686936 --------------
-- Write your Up migrations here
-- ---------- MIGRONDI:DOWN:1586550686936 --------------
-- Write how to revert the migration here
Please do not remove the MIGRONDI:UP:TIMESTAMP
and MIGRONDI:DOWN:TIMESTAMP
comments these are used to differentiate what to run when you run the up
or down
commands.
Up
To run your migrations against your database use the "up" command Migrondi.exe up
you can use -t <number>
to specify how many migrations you want to run
Down
To rollback your migrations from your database use the "down" command Migrondi.exe down
you can use -t <number>
to specify how many migrations you want to roll back
List
If you want to list migrations you can use the command "list" Migrondi.exe list
with the following flag combinations
Migrondi.exe list --last true
Migrondi.exe list --all true --missing true
Migrondi.exe list --all true --missing false
these will give you these outputs
- Last migration in the database
- All migrations that are missing
- All migrations present in the database
Build
Use the build.fsx (dotnet fsi build.fsx
) script or clone and run
dotnet publish -c Release -r <RID> --self-contained true -p:PublishSingleFile=true -o dist
replace RID and the angle brackets with any of the following
this should give you a binary file in the dist
directory, after that put it wherever you want and add it to your path and you can start using it
Product | Versions 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 is compatible. 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. |
-
net6.0
- FSharp.Core (>= 8.0.401)
- FSharp.UMX (>= 1.1.0)
- FsToolkit.ErrorHandling (>= 4.15.1)
- FsToolkit.ErrorHandling.TaskResult (>= 4.15.1)
- IcedTasks (>= 0.11.3)
- Microsoft.Extensions.Logging (>= 8.0.0)
- Microsoft.Extensions.Logging.Console (>= 8.0.0)
- RepoDb (>= 1.13.1)
- RepoDb.MySqlConnector (>= 1.13.1)
- RepoDb.PostgreSql (>= 1.13.1)
- RepoDb.Sqlite.Microsoft (>= 1.13.1)
- RepoDb.SqlServer (>= 1.13.1)
- Thoth.Json.Net (>= 11.0.0)
-
net8.0
- FSharp.Core (>= 8.0.401)
- FSharp.UMX (>= 1.1.0)
- FsToolkit.ErrorHandling (>= 4.15.1)
- FsToolkit.ErrorHandling.TaskResult (>= 4.15.1)
- IcedTasks (>= 0.11.3)
- Microsoft.Extensions.Logging (>= 8.0.0)
- Microsoft.Extensions.Logging.Console (>= 8.0.0)
- RepoDb (>= 1.13.1)
- RepoDb.MySqlConnector (>= 1.13.1)
- RepoDb.PostgreSql (>= 1.13.1)
- RepoDb.Sqlite.Microsoft (>= 1.13.1)
- RepoDb.SqlServer (>= 1.13.1)
- Thoth.Json.Net (>= 11.0.0)
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.0.0-beta-011 | 31 | 10/31/2024 |
1.0.0-beta-010 | 86 | 2/18/2024 |
1.0.0-beta-009 | 57 | 2/17/2024 |
1.0.0-beta-008 | 74 | 2/8/2024 |
1.0.0-beta-007 | 50 | 2/8/2024 |
1.0.0-beta-006 | 81 | 10/11/2023 |
1.0.0-beta-005 | 67 | 10/4/2023 |
1.0.0-beta-004 | 69 | 10/2/2023 |
1.0.0-beta-003 | 79 | 10/1/2023 |
1.0.0-beta-002 | 69 | 10/1/2023 |
1.0.0-beta-001 | 81 | 9/27/2023 |