I'm using Laravel 5.7 along with SQL Server 2017 and I want to generate a varchar(50) column called name.
Executing this code gives me a nvarchar(50) instead:
Schema::create('test', function(Blueprint $table) {
$table->string('name', 50);
});
How can I differentiate between creating a varchar or nvarchar field?
This is a shot in the dark as I don't have SQL Server to test. But basically you can just extend the
BlueprintandSqlServerGrammarclasses and add your own column types. Please test and let me know. :)Create a folder called
Schemasunder theappfolder, then create foldersBlueprintsandGrammarsunder theSchemasfolder. Inside them, create your PHP classes:CustomBlueprint.php
CustomGrammar.php
Your migration file: