Implement and align DbType.Time support across database dialects#163
Implement and align DbType.Time support across database dialects#163Copilot wants to merge 6 commits into
DbType.Time support across database dialects#163Conversation
Agent-Logs-Url: https://github.com/dotnetprojects/Migrator.NET/sessions/439a3240-c184-402f-8fb3-17c4aab1fbeb Co-authored-by: jogibear9988 <364896+jogibear9988@users.noreply.github.com>
DbType.Time
|
@copilot also create tests |
Added in |
There was a problem hiding this comment.
Pull request overview
This PR fixes SQL Server handling of DbType.Time so that migrations can create real TIME columns and schema introspection can resolve SQL Server time metadata back to DbType.Time, preventing type round-trip mismatches.
Changes:
- Map
DbType.Timeto SQL ServerTIMEinSqlServerDialect(instead ofDATETIME). - Extend SQL Server schema introspection (
GetColumns) to recognizetimeand map it toMigratorDbType.Time. - Add regression tests covering dialect-level mapping and provider-level add/readback for
DbType.Time.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/Migrator/Providers/Impl/SqlServer/SqlServerTransformationProvider.cs |
Adds schema metadata parsing for SQL Server time → MigratorDbType.Time. |
src/Migrator/Providers/Impl/SqlServer/SqlServerDialect.cs |
Changes dialect type mapping for DbType.Time to emit TIME. |
src/Migrator.Tests/Providers/SQLServer/SQLServerTransformationProvider_AddTableTests.cs |
Adds integration coverage to ensure DbType.Time round-trips via AddTable / GetColumnByName. |
src/Migrator.Tests/ColumnPropertyMapperTest.cs |
Adds unit coverage ensuring dialect maps DbType.Time ↔ database type name time. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| else if (dataTypeString == "time") | ||
| { | ||
| column.MigratorDbType = MigratorDbType.Time; |
| RegisterColumnType(DbType.String, 4000, "NVARCHAR($l)"); | ||
| RegisterColumnType(DbType.String, int.MaxValue, "NVARCHAR(max)"); | ||
| //RegisterColumnType(DbType.String, 1073741823, "NTEXT"); | ||
| RegisterColumnType(DbType.Time, "DATETIME"); | ||
| RegisterColumnType(DbType.Time, "TIME"); | ||
| RegisterColumnType(DbType.VarNumeric, "NUMERIC(18,0)"); |
There was a problem hiding this comment.
Addressed in 4596e13. SqlServerDialect.Default now emits quoted TimeSpan defaults for SQL Server TIME columns, and I added a focused test covering the generated SQL.
Agent-Logs-Url: https://github.com/dotnetprojects/Migrator.NET/sessions/0ab9f682-2192-4257-b5e8-a8f5da25d152 Co-authored-by: jogibear9988 <364896+jogibear9988@users.noreply.github.com>
|
@copilot what about the other databases? We always should implement features for all |
Agent-Logs-Url: https://github.com/dotnetprojects/Migrator.NET/sessions/b2c708ee-90fa-4e09-a63d-f7ca8baf53cb Co-authored-by: jogibear9988 <364896+jogibear9988@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnetprojects/Migrator.NET/sessions/b2c708ee-90fa-4e09-a63d-f7ca8baf53cb Co-authored-by: jogibear9988 <364896+jogibear9988@users.noreply.github.com>
Added focused tests in f7aec93/980835d: cross-database dialect tests for
Handled in f7aec93. I extended the follow-up beyond SQL Server by adding |
DbType.TimeDbType.Time support across database dialects
|
@copilot the build fails, look after it |
Agent-Logs-Url: https://github.com/dotnetprojects/Migrator.NET/sessions/47922b64-b978-4b97-96e7-50d505b94852 Co-authored-by: jogibear9988 <364896+jogibear9988@users.noreply.github.com>
Fixed in 1027e03. The failing CI test was PostgreSQL Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Uh oh!
There was an error while loading. Please reload this page.