Note: This API documentation is for FAKE version 4. The migration API documentation can be found here. The API documentation for the new fake 5 modules can be found here

SqlServer

Nested types and modules

TypeDescription
ServerInfo

Functions and values

Function or valueDescription
Attach serverInfo attachOptions files
Signature: serverInfo:ServerInfo -> attachOptions:AttachOptions -> files:seq<string> -> ServerInfo

Attach a database

CreateDb(serverInfo)
Signature: serverInfo:ServerInfo -> ServerInfo

Creates a new db on the given server

Detach(serverInfo)
Signature: serverInfo:ServerInfo -> ServerInfo

Detaches a database

Disconnect(serverInfo)
Signature: serverInfo:ServerInfo -> unit

Closes the connection to the server

DropAndCreateDatabase(connectionString)
Signature: connectionString:string -> unit

Drops and creates the database (dropped if db exists. created nonetheless)

DropDb(serverInfo)
Signature: serverInfo:ServerInfo -> ServerInfo

Drops the given InitialCatalog from the server (if it exists)

existDBOnServer serverInfo dbName
Signature: serverInfo:ServerInfo -> dbName:string -> bool

Checks whether the given Database exists on the server

getDatabase(serverInfo)
Signature: serverInfo:ServerInfo -> Database

Gets the initial catalog as database instance

getDatabaseNamesFromServer(serverInfo)
Signature: serverInfo:ServerInfo -> seq<string>

gets the DatabaseNames from the server

getDatabasesFromServer(serverInfo)
Signature: serverInfo:ServerInfo -> seq<Database>

gets the DatabaseNames from the server

getDBName(serverInfo)
Signature: serverInfo:ServerInfo -> string

Gets the initial catalog name

getServerInfo(connectionString)
Signature: connectionString:string -> ServerInfo

Gets a connection to the SQL server and an instance to the ConnectionStringBuilder

getServerName(serverInfo)
Signature: serverInfo:ServerInfo -> string

Gets the name of the server

intitialCatalogExistsOnServer(...)
Signature: serverInfo:ServerInfo -> bool

Checks whether the given InitialCatalog exists on the server

KillAllProcesses(serverInfo)
Signature: serverInfo:ServerInfo -> ServerInfo

Kills all processes with the given server info

ReplaceDatabaseFiles(...)
Signature: connectionString:string -> targetDir:string -> files:seq<string> -> attachOptions:AttachOptions -> unit

Replaces the database files

ReplaceDatabaseFilesWithCache(...)
Signature: connectionString:string -> targetDir:string -> cacheDir:string -> files:seq<string> -> attachOptions:AttachOptions -> unit

Replaces the database files from a cache. If the files in the cache are not up to date, they will be refreshed.

runScript serverInfo sqlFile
Signature: serverInfo:ServerInfo -> sqlFile:string -> unit

Runs a sql script on the server.

RunScripts connectionString scripts
Signature: connectionString:string -> scripts:seq<string> -> unit

Runs the given sql scripts on the server.

RunScriptsFromDirectory(...)
Signature: connectionString:string -> scriptDirectory:string -> unit

Runs all sql scripts from the given directory on the server.