microsoft / go-sqlcmd

The new sqlcmd, CLI for SQL Server and Azure SQL (winget install sqlcmd / sqlcmd create mssql / sqlcmd open ads)
https://learn.microsoft.com/sql/tools/sqlcmd/go-sqlcmd-utility
MIT License
337 stars 59 forks source link

delete-context deletes child objects #244

Closed bweissman closed 1 year ago

bweissman commented 1 year ago

when deleting a context, this also deletes the referenced endpoint and user.

this should not happen as I may just delete the context to recreate with a different endpoint or user.

while there is a --cascade switch, it's defaulting to true and there is no (visible?) way of setting it to false

bweissman commented 1 year ago

using --cascade=false works (= is key here)

stuartpa commented 1 year ago

Sweet, is there anything more we need to do with this issue?

bweissman commented 1 year ago

It should probably be highlighted somewhere in docs or quick hint that the = is required (while it's not for most other parameters) but other than that I think this is fine :)

stuartpa commented 1 year ago

Yes, great feedback. I've added an example to the --help, so it is now:

Delete a context

Usage:
  sqlcmd config delete-context [NAME] [flags]

Examples:
# Delete a context (including its endpoint and user)
  sqlcmd config delete-context --name my-context --cascade
  sqlcmd config delete-context my-context --cascade
# Delete a context (excluding its endpoint and user)
  sqlcmd config delete-context --name my-context --cascade=false
  sqlcmd config delete-context my-context --cascade=false
bweissman commented 1 year ago

Perfect!