SkillAgentSearch skills...

Dbflow

DbFlow is a library that helps with schema oriented database tasks

Install / Use

/learn @kullbom/Dbflow
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

DbFlow

DbFlow is a tool with the ambition to help in all stages of developing, testing and deploying databases.

The current version of DbFlow can be used for

  • generate complete scripts for a database schema that can be used for (as an example) improved version control
  • clone the schema of an existing database to another (resolving dependencies for correct order)
  • create a temporary local database that can be used for unit testing or similar
  • Experimental:* Copy data from one database to another (resolving and copying dependant data as well)

NuGet: https://www.nuget.org/packages/DbFlow/

Repo: https://github.com/kullbom/dbflow

DbFlow supports

  • Microsoft Sql Server

Known bugs/limitation

  • Does not consider ANSI PADDING of individual columns
  • XML indexes is not yet fully supported

Planned features:

  • Improved support for copying data
    • Ignore/transform specific data
  • Replace the need for DbUp
  • Generate documentation
  • Support for PostgreSql

Examples

To clone a database (F#):

open Microsoft.Data.SqlClient
open DbFlow
open DbFlow.SqlServer

let options = Options.Default

let logger _message = ()

let srcConnectionStr = ...
let dstConnectionStr = ...

let dbSchema = 
    use connection = new SqlConnection(srcConnectionStr)
    connection.Open()
    Execute.readSchema logger options connection

use connection = new SqlConnection(dstConnectionStr)
connection.Open()
Execute.clone logger options dbSchema connection 

To generate scripts from a database (F#):

open Microsoft.Data.SqlClient
open DbFlow
open DbFlow.SqlServer

let options = Options.Default

let logger _message = ()

let srcConnectionStr = ...
let dstDirectory = ...

let dbSchema = 
    use connection = new SqlConnection(srcConnectionStr)
    connection.Open()
    Execute.readSchema logger options connection

Execute.generateScriptFiles options dbSchema dstDirectory   

To clone a database (C#):

var logger = LoggerModule.fromFunc(s => { });
var options = OptionsModule.Default;

using var sourceConnection = new Microsoft.Data.SqlClient.SqlConnection(sourceConnectionString);
sourceConnection.Open();
var schema = Execute.readSchema(logger, options, sourceConnection);

var cloneDb = Execute.cloneToLocal(logger, options, schema);

To generate scripts from a database (C#):

var logger = LoggerModule.fromFunc(s => { });
var options = OptionsModule.Default;

using var sourceConnection = new Microsoft.Data.SqlClient.SqlConnection(sourceConnectionString);
sourceConnection.Open();
var schema = Execute.readSchema(logger, options, sourceConnection);

Execute.generateScriptFiles(options, schema, destinationDirectory);
View on GitHub
GitHub Stars6
CategoryData
Updated3d ago
Forks1

Languages

TSQL

Security Score

85/100

Audited on Mar 31, 2026

No findings