-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Script, DeployReport, and DriftReport #106
Changes from 6 commits
0f459e3
bd4a11b
5ce949a
3e7a03e
b5d12ba
47c9160
6cbd202
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,6 @@ export interface IBuildAndPublishInputs extends IActionInputs { | |
} | ||
|
||
export enum SqlPackageAction { | ||
// Only the Publish action is supported currently | ||
Publish, | ||
Extract, | ||
Export, | ||
|
@@ -53,15 +52,16 @@ export default class AzureSqlAction { | |
await this._executeSqlFile(this._inputs); | ||
} | ||
else if (this._inputs.actionType === ActionType.BuildAndPublish) { | ||
const dacpacPath = await this._executeBuildProject(this._inputs as IBuildAndPublishInputs); | ||
const buildAndPublishInputs = this._inputs as IBuildAndPublishInputs; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does anything need to be handled in case this doesn't cast successfully? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any invalid inputs should be handled by this point |
||
const dacpacPath = await this._executeBuildProject(buildAndPublishInputs); | ||
|
||
// Reuse DacpacAction for publish | ||
const publishInputs = { | ||
actionType: ActionType.DacpacAction, | ||
connectionConfig: this._inputs.connectionConfig, | ||
connectionConfig: buildAndPublishInputs.connectionConfig, | ||
filePath: dacpacPath, | ||
additionalArguments: this._inputs.additionalArguments, | ||
sqlpackageAction: SqlPackageAction.Publish | ||
additionalArguments: buildAndPublishInputs.additionalArguments, | ||
sqlpackageAction: buildAndPublishInputs.sqlpackageAction | ||
} as IDacpacActionInputs; | ||
await this._executeDacpacAction(publishInputs); | ||
} | ||
|
@@ -164,13 +164,15 @@ export default class AzureSqlAction { | |
let args = ''; | ||
|
||
switch (inputs.sqlpackageAction) { | ||
case SqlPackageAction.Publish: { | ||
args += `/Action:Publish /TargetConnectionString:"${inputs.connectionConfig.ConnectionString}" /SourceFile:"${inputs.filePath}"`; | ||
case SqlPackageAction.Publish: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about leveraging There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually I removed the redundant logic of checking for no action passed in here. SqlPackageAction should be set already at this point coming from the earlier check. |
||
case SqlPackageAction.Script: | ||
case SqlPackageAction.DeployReport: | ||
case SqlPackageAction.DriftReport: | ||
args += `/Action:${SqlPackageAction[inputs.sqlpackageAction]} /TargetConnectionString:"${inputs.connectionConfig.ConnectionString}" /SourceFile:"${inputs.filePath}"`; | ||
break; | ||
} | ||
default: { | ||
|
||
default: | ||
throw new Error(`Not supported SqlPackage action: '${SqlPackageAction[inputs.sqlpackageAction]}'`); | ||
} | ||
} | ||
|
||
if (!!inputs.additionalArguments) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what happens if the user doesn't pass in the OutputPath or DeployScriptPath for these new actions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sqlpackage will error out asking for one of those to be specified |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to do
it.each()
instead of looping with a normal execution?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is jest's syntax for testing against each row of
inputs
, kind of similar to NUnit's test cases.