microsoft / microsoft/DacFx

Add support for ALTER COLUMN WITH (ONLINE=ON)

Open
#483 1 comment 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
460
Forks
29
Avg merge
4d 9h
Merged PRs (30d)
7

Description

**Is your feature request related to a problem? Please describe.**
SQL Server Enterprise Edition and Azure SQL support the concept of "online" schema operations, which perform the operations more slowly but with shorter locking periods. I would like to have the option for `sqlpackage` to generate scripts that take advantage of this functionality where possible for `ALTER COLUMN` commands.

**Describe the solution you'd like**
Either when `/p:PerformIndexOperationsOnline` or a new parameter is enabled, emit `WITH (ONLINE = ON)` when scripting eligible `ALTER COLUMN` commands.

**Describe alternatives you've considered**
A custom deployment contributor that finds eligible operations and updates the SQL before being emitted, similar to the one linked [here](https://github.com/microsoft/DacFx/issues/27#issuecomment-1949300789) for index operations.

**Additional context**
#27 provided support for `WITH (ONLINE = ON)` for index operations. [Per the documentation](https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-table-transact-sql?view=sql-server-ver16#with--online--on--off-as-applies-to-altering-a-column), `ALTER COLUMN` supports it as well, but enabling `/p:PerformIndexOperationsOnline` only enables it for index operations, not `ALTER COLUMN`.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing sqlpackage's handling of ALTER COLUMN scripting and the existing /p:PerformIndexOperationsOnline behavior from issue #27. Check the SQL Server documentation for eligible ALTER COLUMN operations; done means the generated scripts emit WITH (ONLINE = ON) under the chosen parameter without affecting ineligible operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
cli, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.