-
Notifications
You must be signed in to change notification settings - Fork 167
Schema Compare: Fabric Warehouse platform detection + constraint script preservation #2722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
roramsay
wants to merge
10
commits into
microsoft:main
from
roramsay:roramsay/schema-compare-fabric-platform
+1,189
−3
Closed
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
30d90ab
Schema Compare: surface Source/TargetPlatform on the result contract
roramsay 23a8ef5
Schema Compare: read platform from DSP instead of SqlServerVersion
roramsay aa9a076
Schema Compare: keep Fabric Warehouse constraint scripts under table …
roramsay 40f96df
Schema Compare: add Fabric Warehouse unit + integration tests (Featur…
roramsay 5354cee
Schema Compare: bump DacFx to 170.5.38-preview for Fabric cascade fix
roramsay b5ef119
Potential fix for pull request finding
roramsay c2f73df
Schema Compare: address PR review comments (docs + dead code)
roramsay a13fa63
Schema Compare: address second-pass PR review comments
roramsay 339d8d6
Schema Compare: broaden reflection binding flags for DacFx forward-co…
roramsay 9ae5d40
Merge remote-tracking branch 'origin/main' into roramsay-microsoft-sc…
roramsay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,22 @@ public class SchemaCompareOperation : IDisposable | |
|
|
||
| public List<DiffEntry> Differences; | ||
|
|
||
| /// <summary> | ||
| /// The platform the comparison ran under (DacFx <c>SqlPlatforms</c> enum name, e.g. | ||
| /// "Sql160", "SqlAzureV12", "SqlDwUnified"). Sourced from the comparison's | ||
| /// <c>DatabaseSchemaProvider.Platform</c> (the unified DSP the comparison normalized | ||
| /// to). Source and Target carry the same value because DacFx runs a single comparison | ||
| /// under a single DSP — see <see cref="SchemaCompareUtils.GetComparisonPlatform"/>. | ||
| /// Null if the | ||
| /// platform could not be detected (e.g. the comparison was never run). | ||
|
Comment on lines
+45
to
+46
|
||
| /// </summary> | ||
| public string SourcePlatform { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The platform the comparison ran under. See <see cref="SourcePlatform"/>. | ||
| /// </summary> | ||
| public string TargetPlatform { get; set; } | ||
|
|
||
| public SchemaCompareOperation(SchemaCompareParams parameters, ISchemaCompareConnectionProvider connectionProvider) | ||
| { | ||
| Validate.IsNotNull("parameters", parameters); | ||
|
|
@@ -117,6 +133,26 @@ public void Execute() | |
| } | ||
| } | ||
|
|
||
| // Expose the platform the comparison actually ran under so clients can show | ||
| // the user which T-SQL dialect Schema Compare is using (e.g. "SqlDwUnified" | ||
| // when comparing Fabric Warehouse endpoints). | ||
| // | ||
| // We CANNOT use ComparisonResult.SourceModel.Version because DacFx maps the | ||
| // SqlDwUnified platform to SqlServerVersion.Sql150 in | ||
| // InternalModelUtils.CalculateVersionsForPlatform (it predates the | ||
| // SqlServerVersion.SqlDwUnified enum value). The TSqlModel.Version surface | ||
| // therefore reports "Sql150" for every Fabric Warehouse model, which would | ||
| // mislabel the platform pill in the UI. | ||
| // | ||
| // Instead, read the comparison's normalized DSP from | ||
| // SchemaComparisonResult.DataModel.DatabaseSchemaProvider.Platform via | ||
| // reflection. DatabaseSchemaProvider is internal-abstract in DacFx, but | ||
| // .Platform is a public abstract SqlPlatforms property (a public enum), and | ||
| // the cascade fix in PR 2143938 confirms this value is reliably populated. | ||
| string comparisonPlatform = SchemaCompareUtils.GetComparisonPlatform(this.ComparisonResult); | ||
| this.SourcePlatform = comparisonPlatform; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. source and target are the same? |
||
| this.TargetPlatform = comparisonPlatform; | ||
|
|
||
| // Appending the set of errors that are stopping the schema compare to the ErrorMessage | ||
| // GetErrors return all type of warnings, and error messages. Only filtering the error type messages here | ||
| var errorsList = ComparisonResult.GetErrors().Where(x => x.MessageType.Equals(DacMessageType.Error)).Select(e => e.Message).Distinct().ToList(); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.