From 22ee564fef5de7334528b7bd886b71fa99943423 Mon Sep 17 00:00:00 2001 From: memory-thrasher Date: Wed, 31 May 2023 11:29:11 -0400 Subject: [PATCH] Fixes attempt to scaffold triggers on synapse re: issue #30998 --- .../Internal/SqlServerDatabaseModelFactory.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs b/src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs index a98024e2e43..f4f0a9a1f28 100644 --- a/src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs +++ b/src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs @@ -676,7 +676,11 @@ FROM [sys].[views] AS [v] } GetForeignKeys(connection, tables, tableFilterSql); - GetTriggers(connection, tables, tableFilterSql); + + if (SupportsTriggers()) + { + GetTriggers(connection, tables, tableFilterSql); + } foreach (var table in tables) { @@ -1372,6 +1376,9 @@ private bool SupportsIndexes() private bool SupportsViews() => _engineEdition != 1000; + private bool SupportsTriggers() + => _engineEdition is not 6 and not 11 and not 1000; + private static string DisplayName(string? schema, string name) => (!string.IsNullOrEmpty(schema) ? schema + "." : "") + name;