-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# SqlDeploy | ||
|
||
A little project for creation new databases in MS SQL Server from SQL Project files under .NET Core and Docker environment. | ||
|
||
[![Build status](https://ci.appveyor.com/api/projects/status/oi9nqy36rgj5b9se/branch/master?svg=true)](https://ci.appveyor.com/project/raidenyn/sqldeploy/branch/master) | ||
|
||
Unfortunately we cannot use Microsoft SSDT under Linux environment to create/migrate database version. But sometimes we want to run our tests from Docker and automatic database creation is really important detail for this. This library allows you to create and remove database easily. | ||
|
||
### NuGet installation | ||
``` cmd | ||
dotnet add package SqlDeploy | ||
``` | ||
|
||
### Limitations | ||
* The lib can create database only. It cannot migrate or update exists databases. | ||
* Creation script doesn't sort your DB objects by relations nad creates objects one by one as they are defined in *.sqlproj file. So you have to sort you objects manually to prevent errors bad relations order. | ||
|
||
### Usage sample | ||
|
||
``` cs | ||
// Create a deployer | ||
var deployer = new SqlProjectDeployer("path/to/your.sqlproj"); | ||
|
||
// Create a new db | ||
var database = await deployer.RecreateToAsync( | ||
new SqlConnection("<connection string to MS SQL>"), | ||
databaseName: "NewDBName"); | ||
|
||
// You can work with the new DB here | ||
// Delete the database after tests | ||
await database.DeleteAsync(); | ||
``` | ||
|