|
1 | 1 | <# |
2 | 2 | .SYNOPSIS |
3 | | - Deploys a DACPAC to a SQL Server database. |
| 3 | + Deploys a DACPAC to a SQL Server database. |
| 4 | +
|
4 | 5 | .DESCRIPTION |
5 | | - Handles connection, optional database drop, and calls sqlpackage to deploy |
6 | | - the specified DACPAC to the target database. |
| 6 | + Handles connection, optional database drop, and calls sqlpackage to deploy |
| 7 | + the specified DACPAC to the target database. Supports both interactive and |
| 8 | + automated deployment modes with configurable database purge behavior. |
| 9 | +
|
7 | 10 | .PARAMETER DacpacPath |
8 | | - The path to the DACPAC file to deploy. |
| 11 | + The path to the DACPAC file to deploy. |
| 12 | +
|
9 | 13 | .PARAMETER ConnectionString |
10 | | - The connection string for the SQL Server instance. |
| 14 | + The connection string for the SQL Server instance. |
| 15 | +
|
11 | 16 | .PARAMETER DatabaseName |
12 | | - The name of the database to deploy to (optional). |
| 17 | + The name of the database to deploy to. If not specified, extracted from |
| 18 | + the connection string. |
| 19 | +
|
13 | 20 | .PARAMETER Description |
14 | | - A description for the deployment (optional). |
| 21 | + A description for the deployment (optional). Defaults to the DACPAC filename. |
| 22 | +
|
15 | 23 | .PARAMETER AutoDeploy |
16 | | - If true, skips user prompt and deploys automatically. |
| 24 | + If true, skips user prompt and deploys automatically. |
| 25 | +
|
17 | 26 | .PARAMETER AutoPurge |
18 | | - If true, drops the database if it exists before deploying. |
| 27 | + If true, drops the database if it exists before deploying. |
| 28 | +
|
19 | 29 | .EXAMPLE |
20 | | - Deploy-Dacpac -DacpacPath "./db/Direct_Framework.dacpac" -ConnectionString $cs ` |
21 | | - -DatabaseName "Direct_Framework" -AutoDeploy $true -AutoPurge $true |
| 30 | + Deploy-Dacpac -DacpacPath "./db/Direct_Framework.dacpac" -ConnectionString $cs ` |
| 31 | + -DatabaseName "Direct_Framework" -AutoDeploy $true -AutoPurge $true |
| 32 | +
|
| 33 | +.EXAMPLE |
| 34 | + Deploy-Dacpac -DacpacPath $dacpacFile -ConnectionString $connectionString |
| 35 | +
|
| 36 | +.OUTPUTS |
| 37 | + System.Boolean - Returns $true if deployment succeeds, otherwise $false. |
| 38 | +
|
22 | 39 | .NOTES |
23 | | - Returns $true if deployment succeeds, otherwise $false. |
| 40 | + File Name : Deploy-Dacpac.ps1 |
| 41 | + Prerequisite : PowerShell 5.1 or later, sqlpackage dotnet tool |
| 42 | + License : LGPL-3.0 (GNU Lesser General Public License v3.0) |
| 43 | +
|
| 44 | +.LINK |
| 45 | + https://github.com/data-solution-automation-engine/DIRECT |
| 46 | +
|
| 47 | +.LINK |
| 48 | + https://github.com/data-solution-automation-engine/DIRECT/blob/main/COPYING.txt |
| 49 | +
|
| 50 | +.LINK |
| 51 | + https://learn.microsoft.com/en-us/sql/tools/sqlpackage/sqlpackage |
| 52 | +
|
| 53 | +.COMPONENT |
| 54 | + DIRECT Framework - Data Integration Runtime Execution Control Tools |
| 55 | +
|
| 56 | +.FUNCTIONALITY |
| 57 | + Database deployment and DACPAC management. |
24 | 58 | #> |
25 | 59 | function Deploy-Dacpac { |
26 | 60 | param( |
|
0 commit comments