SQL Server provider for NSchema, the declarative database schema migration tool for .NET. It plugs SQL Server introspection and DDL generation into NSchema via Microsoft.Data.SqlClient.
Most users should use the NSchema CLI, which already includes this provider. Add this package directly only when embedding the engine in your own application.
dotnet add package NSchema.Core
dotnet add package NSchema.SqlServer- SQL Server 2016 SP1 or newer
This provider implements all the parts of NSchema's model that are compatible with SQL Server:
- Supported: schemas, tables, columns (with
DEFAULT,IDENTITY, and persisted computed columns), primary keys, foreign keys, unique constraints, check constraints, indexes (includingINCLUDEcolumns and filtered indexes), views, sequences, scalar/table functions and stored procedures, table-levelGRANTs, triggers, and documentation comments (stored asMS_Descriptionextended properties). - Identifiers are emitted with brackets (
[schema].[name]). - Column changes. SQL Server's
ALTER COLUMNrestates the column's whole type and nullability at once, so NSchema.Core supplies both on the migration actions and the generator folds a paired type/nullability change into one statement. - Not supported (no SQL Server equivalent): enums, domains, composite types, extensions, exclusion constraints, schema renames, and materialized (indexed) views. In-place changes to an identity's seed/increment or a computed column's expression require a table rebuild and raise a clear
NotSupportedException. These all raiseNotSupportedExceptionrather than emitting partial SQL.
NSchema's canonical types map to SQL Server's: boolean → bit, double → float, datetime → datetime2, guid → uniqueidentifier, unbounded varchar/nvarchar/varbinary → (max), and so on.
Full documentation lives at nschema.dev:
See LICENSE.
