danielwertheim

danielwertheim


notes from a passionate developer

Share


Sections


Tags


Disclaimer

This is a personal blog. The opinions expressed here represent my own and not those of my employer, nor current or previous. All content is published "as is", without warranty of any kind and I don't take any responsibility and can't be liable for any claims, damages or other liabilities that might be caused by the content.

My first F# project - dotnet-sqldb

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

dotnetsqldb-v013-ensure

UpgradeDb

Upgrades the database by applying SQL-scripts using DbUp

dotnet-sqldb up
      --connectionstring mycnstring
      --assembly myassembly_with_embedded_scripts

dotnetsqldb-v013-up

DropDb

Drops the specified database if it exists.

dotnet-sqldb drop
      --connectionstring mycnstring

dotnetsqldb-v013-drop

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

View Comments