From c8b267d1e0760735efb538979e83fdc570717dca Mon Sep 17 00:00:00 2001 From: Erik Ejlskov Jensen Date: Thu, 6 Jul 2023 18:53:46 +0200 Subject: [PATCH] Disable trigger enumeration on Azure Synapse Analytics, where triggers are not supported (#31036) See https://learn.microsoft.com/azure/synapse-analytics/sql/overview-features fixes #30998 Co-authored-by: Erik Ejlskov Jensen --- .../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 67aada2f9f7..5195c960457 100644 --- a/src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs +++ b/src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs @@ -648,7 +648,11 @@ FROM [sys].[views] AS [v] GetColumns(connection, tables, filter, viewFilter, typeAliases, databaseCollation); GetIndexes(connection, tables, filter); GetForeignKeys(connection, tables, filter); - GetTriggers(connection, tables, filter); + + if (SupportsTriggers()) + { + GetTriggers(connection, tables, filter); + } foreach (var table in tables) { @@ -1343,6 +1347,9 @@ private bool SupportsMemoryOptimizedTable() private bool SupportsSequences() => _compatibilityLevel >= 110 && _engineEdition != 6; + private bool SupportsTriggers() + => _engineEdition != 6; + private static string DisplayName(string? schema, string name) => (!string.IsNullOrEmpty(schema) ? schema + "." : "") + name;