Skip to content

Commit 5994293

Browse files
authored
Validate changes for deletions
1 parent 7684697 commit 5994293

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

KustoSchemaTools/Changes/DeletionChange.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,17 @@ public DeletionChange(string entity, string entityType)
1515

1616
public string Entity { get; set; }
1717

18-
public List<DatabaseScriptContainer> Scripts => new List<DatabaseScriptContainer> { new DatabaseScriptContainer("Deletion", 0, $".drop {EntityType} {Entity}") };
18+
public List<DatabaseScriptContainer> Scripts
19+
{
20+
get
21+
{
22+
var sc = new DatabaseScriptContainer("Deletion", 0, $".drop {EntityType} {Entity}");
23+
var code = KustoCode.Parse(sc.Text);
24+
var diagnostics = code.GetDiagnostics();
25+
sc.IsValid = diagnostics.Any() == false;
26+
return new List<DatabaseScriptContainer> { sc };
27+
}
28+
}
1929

2030
public string Markdown
2131
{

0 commit comments

Comments
 (0)