microsoft / microsoft/DacFx

Cannot deploy dacpac with Graph Table that has edges

Open
#398 0 comments 0 reactions 0 assignees View on GitHub
bug sql-feature
Dominant language
C#
Stars
460
Forks
29
Avg merge
4d 9h
Merged PRs (30d)
7

Description

Steps to reproduce:
1. Back up a dacpac with DacService.Extract, with ExtractAllTableData = true
1. Restore the backup with DacServices.Deploy. Iterations I've tried are:
- Completely dropping the table and then creating it with Deploy
- Using CreateNewDatabase = true in the options object, and specifying upgradeExisting = false param.
- Specify options with DoNotDropObjectTypes = new ObjectType[] { ObjectType.Tables}

Error:
{"Could not deploy package.\r\nError SQL72014: Core Microsoft SqlClient Data Provider: Msg 13944, Level 16, State 1, Line 1 Cannot truncate table 'dbo.B2bCustomerNode' because it is being referenced by an EDGE constraint.\r\nError SQL72045: Script execution error. The executed script:\r\nTRUNCATE TABLE [dbo].[B2bCustomerNode];\r\n\r\n\r\n"}

B2bCustomerNode is a Sql Graph Node, and it does have an edge table constraint.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with DacService.Extract using ExtractAllTableData = true, then restore with DacServices.Deploy and the listed deployment options. Start by tracing the deployment path that emits TRUNCATE TABLE for dbo.B2bCustomerNode and how graph node and edge constraints are handled. Done means a dacpac containing graph tables with edges can be deployed without the SQL72014 truncation failure.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.