Tests failing following release of Rails v7.0.5
aidanharan opened this issue · 0 comments
Issue
The CI tests are failing following the release of Rails v7.0.5. The issue is caused by rails/rails#46110
Expected behavior
Tests should pass.
Actual behavior
When the test database schema is being created the adapter is sending invalid SQL to MSSQL which results in the error message:
TinyTds::Error: Column, parameter, or variable #4: Cannot specify a column width on data type datetime. (ActiveRecord::StatementInvalid)
The issue is with the SQL used to generate data-time columns. For the aircraft table (https://github.com/rails/rails/blob/v7.0.5/activerecord/test/schema/schema.rb#L57) the difference is as follows:
Rails v7.0.4
CREATE TABLE [aircraft] ([id] bigint NOT NULL IDENTITY(1,1) PRIMARY KEY, [name] nvarchar(4000), [wheels_count] integer DEFAULT 0 NOT NULL, [wheels_owned_at] datetime2(6), [manufactured_at] datetime DEFAULT CURRENT_TIMESTAMP)Rails v7.0.5
CREATE TABLE [aircraft] ([id] bigint NOT NULL IDENTITY(1,1) PRIMARY KEY, [name] nvarchar(4000), [wheels_count] integer DEFAULT 0 NOT NULL, [wheels_owned_at] datetime(6), [manufactured_at] datetime(6) DEFAULT CURRENT_TIMESTAMP)Columns of type datetime cannot have precision.
The SQL generated for Rails v7.0.5 for the aircraft table has 2 issues:
- The
wheels_owned_atcolumn type has changed fromdatetime2(6)todatetime(6). - The
manufactured_atcolumn type has changed fromdatetimetodatetime(6).
How to reproduce
Run the CI tests.
Details
- Rails version:
7.0.5 - SQL Server adapter version:
7.0.1.0