Azure SQL Server edge constraint order

47 Views Asked by At

I'm using azure sql graph tables (nodes and edges) to build a solution. When deploying the dacpac file from devops i get an error because my edge constraints have different sort order (ECC.clause_number in example below).

This happens for edge constraints with multiple FROM->TO. Is it possible to change the sort order? If I drop the table and recreate it the order will differ between my databases.

Thankful for any ideas to solve. The error disappears if i change the databaseproject and deploy.

SELECT
   EC.name AS edge_constraint_name
   , ECC.clause_number
   , OBJECT_NAME(EC.parent_object_id) AS edge_table_name
   , OBJECT_NAME(ECC.from_object_id) AS from_node_table_name
   , OBJECT_NAME(ECC.to_object_id) AS to_node_table_name
   , is_disabled
   , is_not_trusted  
FROM sys.edge_constraints EC
   INNER JOIN sys.edge_constraint_clauses ECC
   ON EC.object_id = ECC.object_id
WHERE OBJECT_NAME(EC.parent_object_id) = 'MyEdgeConstraint'
ORDER BY ec.Name, ECC.clause_number

My dacpac error:

An unexpected failure occurred: Unable to cast object of type 'Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlEdgeConstraint' to type 'Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlUniqueConstraint'..

I've tried to find documentation from Microsoft but could not find any.

0

There are 0 best solutions below