Skip to content
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

Publishing dacpac will fail if table has CHANGE_TRACKING ON #25592

Open
GardarG opened this issue Apr 16, 2024 · 2 comments
Open

Publishing dacpac will fail if table has CHANGE_TRACKING ON #25592

GardarG opened this issue Apr 16, 2024 · 2 comments

Comments

@GardarG
Copy link

GardarG commented Apr 16, 2024

Type: Bug

Steps to Reproduce:

  1. Create a database with CHANGE_TRACKING enabled and a table with CHANGE_TRACKING enabled
  2. Publish the same database without changes and it will fail.

When looking further into the sqlcmd script that is created, we see that the following code is run BEFORE pre-deployment scripts:

IF EXISTS (SELECT 1
FROM [sys].[databases]
WHERE [name] = N'$(DatabaseName)')
BEGIN
ALTER DATABASE [$(DatabaseName)]
SET CHANGE_TRACKING = OFF
WITH ROLLBACK IMMEDIATE;
END
GO

As such it is impossible to have change-tracking on a table when publishing. There should be settings in the .publish.xml file to comment out / disable these lines of code.

Extension version: 1.4.2
Azure Data Studio version: azuredatastudio 1.48.0 (4970733, 2024-02-27T00:05:08.293Z)
OS version: Windows_NT x64 10.0.19045
Restricted Mode: No
Preview Features: Enabled
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz (12 x 2208)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 15.74GB (2.20GB free)
Process Argv
Screen Reader no
VM 0%
@arkdvd
Copy link

arkdvd commented Apr 26, 2024

Trying to ask if is this addressed ?. I ran into same issue

@arkdvd
Copy link

arkdvd commented Apr 29, 2024

@GardarG : Things worked for me by setting below options in publish file & I no longer see ALTER DB SET CHANGE_TRACKING = OFF WITH ROLLBACK IMMEDIATE;

DoNotAlterChangeDataCaptureObjects = False
DoNotAlterReplicatedObjects = False
ScriptDatabaseOptions = False
IgnoreTableOptions = False

However I still see a comment in deployment script with PRINT N'Altering table [user_schemaname].[user_tablename]...;' for the table with CDC enabled in my database. But no actual code beneath the comment. Not sure if this is bug or anything to do with my setting.

Please let me know if you see the same on your end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants