You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds composable SQL predicates, OLD/NEW bindings, related-row EXISTS guards and fluent create/drop/preview operations. One definition renders native aborting triggers for SQLite, PostgreSQL, SQL Server, MySQL, MariaDB, Oracle, Db2, Firebird, Informix, Sybase ASE and SAP HANA. Ingres remains an explicit implementation gap.
GuardTriggerProviderTests runs the same behaviors on all eleven engines through both direct SQL and the database-independent Insert/Update/Delete/Select APIs: rejection with the domain error, allowed writes, drop/retry, atomic multirow update/delete, null-safe changes and both reparenting directions. Direct-SQL enforcement tests are retained unchanged. The projected multirow insert API enters in #219, which adds its guard conformance test to this same eleven-provider fixture.
SQLite attached-table predicates bind within the subject database while main/TEMP target names remain unambiguous. Provider namespace, native literal, helper cleanup, pairing-key and DDL/version restrictions are documented. Local focused tests pass; GitHub Actions runs the eleven live database suites, including Oracle and HANA.
SQLite exported UPDATE OF clauses are validated against queued/renamed table definitions or the preview's existing-table metadata callback. Missing metadata, schema invalidated by raw SQL, unknown watched columns and unverified implicit rowid aliases fail explicitly. The shared guard/audit export regressions include executing generated scripts and verifying writes through the database-independent APIs.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical schema-resolution defects can attach guards to unintended tables or query the wrong related rows, while additional SQL-generation flaws can bypass guards or break migrations.
Adds database-enforced conditional write guards to the migration API, addressing issue #209 with composable predicates and provider-specific trigger generation.
Changes:
Introduces SQL expressions with OLD/NEW bindings and related-row EXISTS conditions.
Adds guard creation, removal, and fluent SQL preview for SQLite, PostgreSQL, SQL Server, and MySQL/MariaDB.
Adds provider tests and documents transaction behavior, pairing-key requirements, and concurrency limits.
File
Description
src/Migrator/Framework/SqlExpression.cs
Defines composable predicates, row bindings, and literal rendering.
src/Migrator/Framework/GuardTrigger.cs
Defines guards and generates provider-specific create/drop SQL.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved critical flaws in schema resolution, SQL Server alias handling, and Unicode literals can cause guards to check the wrong data or allow prohibited writes.
Mutating KeyColumns or UpdateColumns on a built GuardTriggerOperation changes later Preview/Apply calls because every build returns the same operation. This violates the independent-build snapshot behavior tested in src/Migrator.Tests/FluentAuthoringTests.cs:58-74 and :150-170. Keep a private input snapshot and enqueue a factory that clones both arrays for each build.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved critical defects in NULL handling, schema resolution, alias binding, and drop validation can bypass guards, target incorrect tables, or fail migrations after earlier DDL executes.
Resolve trigger tables using the provider's configured schema
src/Migrator/Framework/GuardTrigger.cs:28
Rendering with only the dialect bypasses the provider's configured default schema: a provider scoped to tenant can create tenant.child through AddTable but install this guard on a different, unqualified child, or fail. The same issue affects drop at GuardTrigger.cs:32 and related-table EXISTS at SqlExpression.cs:40. Use provider-aware table resolution for create, drop, and related-table expressions so all target the configured namespace.
Reject SQL Server 2005 for unsupported THROW statements
src/Migrator/Framework/GuardTrigger.cs:61
SqlServer2005Dialect inherits SqlServerDialect, so this support check accepts ProviderTypes.SqlServer2005 and renders THROW statements that SQL Server 2005 cannot execute. This also lets definition validation and preview succeed for an unsupported engine. Reject the legacy dialect explicitly unless a compatible rollback/error implementation is provided.
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
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.
Adds composable SQL predicates, OLD/NEW bindings, related-row EXISTS guards and fluent create/drop/preview operations. One definition renders native aborting triggers for SQLite, PostgreSQL, SQL Server, MySQL, MariaDB, Oracle, Db2, Firebird, Informix, Sybase ASE and SAP HANA. Ingres remains an explicit implementation gap.
GuardTriggerProviderTests runs the same behaviors on all eleven engines through both direct SQL and the database-independent Insert/Update/Delete/Select APIs: rejection with the domain error, allowed writes, drop/retry, atomic multirow update/delete, null-safe changes and both reparenting directions. Direct-SQL enforcement tests are retained unchanged. The projected multirow insert API enters in #219, which adds its guard conformance test to this same eleven-provider fixture.
SQLite attached-table predicates bind within the subject database while main/TEMP target names remain unambiguous. Provider namespace, native literal, helper cleanup, pairing-key and DDL/version restrictions are documented. Local focused tests pass; GitHub Actions runs the eleven live database suites, including Oracle and HANA.
First PR in https://github.com/dotnetprojects/Migrator.NET/stack/221: #215 → #216 → #217 → #218 → #219 → #220 → #222.
Closes #209.
SQLite exported UPDATE OF clauses are validated against queued/renamed table definitions or the preview's existing-table metadata callback. Missing metadata, schema invalidated by raw SQL, unknown watched columns and unverified implicit rowid aliases fail explicitly. The shared guard/audit export regressions include executing generated scripts and verifying writes through the database-independent APIs.