Cake.SqlServer addin
This content is part of a third party extension that is not supported by the Cake project.
For more information about this extension see Cake.SqlServer.
Contains functionality to deal with SQL Server: DropDatabase, CreateDatabase, execute SQL, execute SQL from files, etc. Provides functionality to manage LocalDb instances: Create, Start, Stop, Delete instances;
In order to use the commands for this addin, include the following in your build.cake file to download and reference from NuGet.org:
#addin "nuget:?package=Cake.SqlServer"
General
BackupDatabase Alias from Cake.SqlServer addin |
Backup an existing database to a file. |
CreateBacpacFile Alias from Cake.SqlServer addin |
Creates a bacpac file for easy database backuping. |
CreateDatabase Alias from Cake.SqlServer addin |
Creates an empty database. If database with this name already exists, throws a SqlException. Allows to specify primary and log files location. |
CreateDatabase Alias from Cake.SqlServer addin |
Creates an empty database. If database with this name already exists, throws a SqlException.
Cake.SqlServer.SqlServerAliases.CreateDatabaseIfNotExists(Cake.Core.ICakeContext,System.String,System.String) if you would like to check if database already exists.
|
Create Alias from Cake.SqlServer addin |
Creates an empty database if another database with the same does not already exist. |
Create Alias from Cake.SqlServer addin |
Creates an empty database if another database with the same does not already exist. |
DatabaseExists Alias from Cake.SqlServer addin |
Test if the database exists |
Drop Alias from Cake.SqlServer addin |
First drops, then recreates the database |
Drop Alias from Cake.SqlServer addin |
First drops, then recreates the database |
DropDatabase Alias from Cake.SqlServer addin |
Drops database. Before dropping the DB, database is set to be offline, then online again. This is to be sure that there are no live connections, otherwise the script will fail. Also if the database does not exist - it will not do anything. |
ExecuteSqlCommand Alias from Cake.SqlServer addin |
Execute any SQL command. |
ExecuteSqlCommand Alias from Cake.SqlServer addin |
Execute any SQL command. |
ExecuteSqlFile Alias from Cake.SqlServer addin |
Reads SQL commands from a file and executes them. |
ExecuteSqlFile Alias from Cake.SqlServer addin |
Reads SQL commands from a file and executes them. |
ExtractDacpacFile Alias from Cake.SqlServer addin |
Extracts a dacpac file to a database package. |
Local Alias from Cake.SqlServer addin |
Creates a server instance and starts the server. |
Local Alias from Cake.SqlServer addin |
Creates a server instance and starts the server. The version number defaults to the version of the SqlLocalDB utility |
Local Alias from Cake.SqlServer addin |
Deletes the LocalDB instance |
LocalDbStartInstance Alias from Cake.SqlServer addin |
Starts the LocalDB instance. Instance must exist before you can start it. |
LocalDbStopInstance Alias from Cake.SqlServer addin |
Stops the LocalDB instance. |
OpenSqlConnection Alias from Cake.SqlServer addin |
Opens a new Microsoft.Data.SqlClient.SqlConnection with the given connection string.
|
PublishDacpacFile Alias from Cake.SqlServer addin |
Publish a dacpac file to a database. |
RestoreBacpac Alias from Cake.SqlServer addin |
Restores a bacpac file into a database.
NB: there must be no database with the name you provide. Otherwise exception will be thrown. |
Restore Alias from Cake.SqlServer addin |
Restores a database from multiple backup files. |
RestoreSqlBackup Alias from Cake.SqlServer addin |
Restores a database from a backup file. |
RestoreSqlBackup Alias from Cake.SqlServer addin |
Restores a database from a backup file. |
SetSqlCommandTimeout Alias from Cake.SqlServer addin |
Sets the CommandTimeout property for all SqlCommands used internally |