Skip to content

Conversation

@n9rrrx
Copy link

@n9rrrx n9rrrx commented Dec 12, 2025

Fixes #57965
This PR implements version detection in SqlServerGrammar to utilize the native JSON datatype for SQL Server 2025+ while maintaining the nvarchar(max) fallback for older versions, as requested in the issue.

@taylorotwell
Copy link
Member

Tests are failing.

@taylorotwell taylorotwell marked this pull request as draft December 12, 2025 15:04
$column = new \Illuminate\Support\Fluent(['name' => 'data', 'type' => 'json']);

// Assert that the Grammar returns the native JSON type.
$this->assertEquals('json', $grammar->typeJson($column));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests seem to be failing as the SqlServerGrammar@typeJson() method is protected and thus cannot be called here.

You can take a look on how the MySQL Schema Grammar is tested for the UUID fields (Illuminate\Tests\Database\DatabaseMySqlSchemaGrammarTest).

It tests against the Blueprint statements, which should suffice for this case too.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants