I just introduced my first F# based open source project dotnet-sqldb. It's a DotNet Global Tool, distributed via NuGet. It uses DbUp and Command Line Parser to offer a simple CLI for applying migration scripts etc. against a SQL-Server database. It started out as a C# project that I've been using in my own little projects, but as I've started learning F#, I thought it would be a nice little candidate for getting started.
I'll be doing some separate posts about F# "features", that I (as a C# developer) have appreciated when putting together this small project.
Another post of mine, that might be of interest is: "Resources I've found useful to get going with F#"
Global installation
dotnet tool install -g dotnet-sqldb
Usage either: dotnet-sqldb
or dotnet sqldb
Local installation
To install it locally, you use the dotnet tool install command with the --tool-path
switch:
dotnet tool install dotnet-sqldb --tool-path /path/for/tool
To use it you will need to include it in the current environment path.
Usage
Note: It's your data. Use at your own risk. As the license (MIT) says: "THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND..."
Help
dotnet-sqldb --help
EnsureDb
Ensures that the specified DB exists. If it does not exist, it gets created.
dotnet-sqldb ensure
--connectionstring mycnstring
UpgradeDb
Upgrades the database by applying SQL-scripts using DbUp
dotnet-sqldb up
--connectionstring mycnstring
--assembly myassembly_with_embedded_scripts
DropDb
Drops the specified database if it exists.
dotnet-sqldb drop
--connectionstring mycnstring
Feel free to contribute improvements to the repo at GitHub, so that I get to learn the dos and don'ts of F#.
Cheers,
//Daniel