Open JerryNixon opened 2 years ago
Here's a more detailed reproduction,
create table isPartOf AS EDGE;
GO
CREATE UNIQUE CLUSTERED INDEX [GRAPH_FromTo_INDEX_isPartOf] on isPartOf ($from_id, $to_id) WITH (DATA_COMPRESSION = PAGE);
GO
Deploy the DACPAC once. This succeeds without any error, and the SQL Graph edge table isPartOf
is created exactly as needed.
Now, change the definition of the table in the SQL Database project to the below:
CREATE TABLE [dbo].[isPartOf] (
INDEX [GRAPH_UNIQUE_INDEX_isPartOf] UNIQUE NONCLUSTERED ($edge_id) WITH (DATA_COMPRESSION = PAGE),
INDEX [GRAPH_FromTo_INDEX_isPartOf] CLUSTERED ($from_id, $to_id) WITH (DATA_COMPRESSION = PAGE),
INDEX [GRAPH_ToFrom_INDEX_isPartOf] NONCLUSTERED ($to_id, $from_id) WITH (DATA_COMPRESSION = PAGE)
) AS EDGE;
Try to publish the above changes to the same database as in step 3 above. It fails repeatedly for me with the error:
The write operation failed. You must first acquire write access from DataSchemaModelController.
CREATE TABLE [dbo].[tmp_ms_xx_isPartOf] (
INDEX [GRAPH_UNIQUE_INDEX_isPartOf] UNIQUE NONCLUSTERED ($edge_id),
INDEX [GRAPH_FromTo_INDEX_isPartOf] CLUSTERED ($from_id, $to_id),
INDEX [GRAPH_ToFrom_INDEX_isPartOf] NONCLUSTERED ($to_id, $from_id)
) AS EDGE;
IF EXISTS (SELECT TOP 1 1
FROM [dbo].[isPartOf])
BEGIN
INSERT INTO [dbo].[tmp_ms_xx_isPartOf]
SELECT -- <<<<< note the lack of a column list
FROM [dbo].[isPartOf];
END
DROP TABLE [dbo].[isPartOf];
EXECUTE sp_rename N'[dbo].[tmp_ms_xx_isPartOf]', N'isPartOf';
It should not require dropping and recreate the original table. And at a minimum, it should be able to handle the fact that edge tables in SQL graph can be "empty" i.e. not have any user-defined columns.
Steps to Reproduce:
The script attempts to move the contents of the table to a temp table. When it does this, there is a script error because the SELECT clause has zero columns (also does not have the $from_id, $to_id) and publish can NEVER complete.
Please note: This is not only blocking, this is a devastating error crippling our whole pipeline.