|
3 | 3 |
|
4 | 4 | namespace CmdScale.EntityFrameworkCore.TimescaleDB.Generators |
5 | 5 | { |
6 | | - internal class ContinuousAggregateSqlGenerator |
| 6 | + internal static class ContinuousAggregateSqlGenerator |
7 | 7 | { |
8 | | - private const string CommunityWarning = "Skipping Community Edition features (compression) - not available in Apache Edition"; |
| 8 | + private const string CaggCommunityWarning = "Skipping Community Edition feature (continuous aggregate) - not available in Apache Edition"; |
9 | 9 | private const string AlterDdl = "ALTER MATERIALIZED VIEW"; |
10 | 10 |
|
11 | | - public static List<string> Generate(CreateContinuousAggregateOperation operation, bool useLegacyCompressionNames = false) |
| 11 | + public static List<string> Generate(CreateContinuousAggregateOperation operation, bool useLegacyCompressionNames = false, bool isApacheEdition = false) |
12 | 12 | { |
| 13 | + if (isApacheEdition) |
| 14 | + { |
| 15 | + return [SqlBuilderHelper.SkipComment(CaggCommunityWarning)]; |
| 16 | + } |
| 17 | + |
13 | 18 | string qualifiedIdentifier = SqlBuilderHelper.QualifiedIdentifier(operation.MaterializedViewName, operation.Schema); |
14 | 19 |
|
15 | 20 | List<string> statements = []; |
@@ -67,7 +72,6 @@ private static List<string> GenerateFromRawViewDefinition( |
67 | 72 | operation.CompressionSegmentBy, |
68 | 73 | operation.CompressionOrderBy, |
69 | 74 | AlterDdl, |
70 | | - CommunityWarning, |
71 | 75 | useLegacyCompressionNames); |
72 | 76 |
|
73 | 77 | return statements; |
@@ -191,13 +195,12 @@ private static List<string> GenerateFromStructuredQuery( |
191 | 195 | operation.CompressionSegmentBy, |
192 | 196 | operation.CompressionOrderBy, |
193 | 197 | AlterDdl, |
194 | | - CommunityWarning, |
195 | 198 | useLegacyCompressionNames); |
196 | 199 |
|
197 | 200 | return statements; |
198 | 201 | } |
199 | 202 |
|
200 | | - public static List<string> Generate(AlterContinuousAggregateOperation operation, bool useLegacyCompressionNames = false) |
| 203 | + public static List<string> Generate(AlterContinuousAggregateOperation operation, bool useLegacyCompressionNames = false, bool isApacheEdition = false) |
201 | 204 | { |
202 | 205 | string qualifiedIdentifier = SqlBuilderHelper.QualifiedIdentifier(operation.MaterializedViewName, operation.Schema); |
203 | 206 | List<string> statements = []; |
@@ -248,10 +251,10 @@ public static List<string> Generate(AlterContinuousAggregateOperation operation, |
248 | 251 | if (compressionSettings.Count > 0) |
249 | 252 | { |
250 | 253 | string setClause = $"ALTER MATERIALIZED VIEW {qualifiedIdentifier} SET ({string.Join(", ", compressionSettings)});"; |
251 | | - statements.Add(SqlBuilderHelper.WrapCommunityFeatures([setClause], CommunityWarning)); |
| 254 | + statements.Add(setClause); |
252 | 255 | } |
253 | 256 |
|
254 | | - return statements; |
| 257 | + return SqlBuilderHelper.SkipOnApacheEdition(statements, CaggCommunityWarning, isApacheEdition); |
255 | 258 | } |
256 | 259 |
|
257 | 260 | public static List<string> Generate(DropContinuousAggregateOperation operation) |
|
0 commit comments