Closed aidanharan closed 1 year ago
The CI tests are failing following the release of Rails v7.0.5. The issue is caused by https://github.com/rails/rails/pull/46110
Tests should pass.
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:
aircraft
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.
datetime
The SQL generated for Rails v7.0.5 for the aircraft table has 2 issues:
wheels_owned_at
datetime2(6)
datetime(6)
manufactured_at
Run the CI tests.
7.0.5
7.0.1.0
Issue
The CI tests are failing following the release of Rails v7.0.5. The issue is caused by https://github.com/rails/rails/pull/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
Rails v7.0.5
Columns of type
datetime
cannot have precision.The SQL generated for Rails v7.0.5 for the
aircraft
table has 2 issues:wheels_owned_at
column type has changed fromdatetime2(6)
todatetime(6)
.manufactured_at
column type has changed fromdatetime
todatetime(6)
.How to reproduce
Run the CI tests.
Details
7.0.5
7.0.1.0