Skip to content

Conversation

@atiq-bs23
Copy link
Contributor

@atiq-bs23 atiq-bs23 commented Nov 20, 2025

This PR adds TableFor, ColumnFor and FromTable extension methods for IDeleteExpressionRoot, IAlterExpressionRoot, and ISchemaExpressionRoot to ensure table and column names are resolved via NameCompatibilityManager.

Supports schema checks, altering, adding, and deleting columns in a type-safe manner.

Includes strongly-typed column selector overloads for safer refactoring.

Updated XML summaries for all new methods for consistency with existing extension methods.

Note: Changes in SchemaMigration are only for reference purposes.
These changes will not affect any existing migrations since the NopSchemaMigration attribute date has not been modified, and the migration will not execute.

Now we can write like below

 if (!Schema.TableFor<Topic>().ColumnFor<Topic>(t => t.AvailableEndDateTimeUtc).Exists())
 {
     Alter.TableFor<Topic>()
         .AddColumnFor<Topic>(t => t.AvailableEndDateTimeUtc)
         .AsDateTime()
         .Nullable();
 }
 
var footerColumn1ColumnName = "IncludeInFooterColumn1";
if (Schema.TableFor<Topic>().Column(footerColumn1ColumnName).Exists())
    Delete.Column(footerColumn1ColumnName).FromTable<Topic>();

@atiq-bs23
Copy link
Contributor Author

#7967 #7952 related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add TableFor and ColumnFor support for Alter, Delete and Schema operations using NameCompatibilityManager

3 participants