Created
August 28, 2018 09:32
-
-
Save matthew-inamdar/bf851e0bc4d36082d3cfedb0de4030bf to your computer and use it in GitHub Desktop.
Register enum as string in Laravel migrations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!function_exists('register_enum_type')) { | |
/** | |
* Registers the enum type as a string. | |
* Call this in the constructor of your migration. | |
*/ | |
function register_enum_type() | |
{ | |
\Illuminate\Support\Facades\Schema::getConnection() | |
->getDoctrineSchemaManager() | |
->getDatabasePlatform() | |
->registerDoctrineTypeMapping('enum', 'string'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment