We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
When you want to change the definition of a database enum from a Laravel migration, you can do it like this:
Schema::table('jobs', function (Blueprint $table) {
$table->enum('type', ['contract', 'permanent', 'partial'])->change();
});
Be aware though that support for this depends on the database engine. For MySQL, this is supported, for PostgreSQL and SQL Server, it's not as explained here:
Supported databases, modifiers and types:
Database | Native Support | Supported column modifiers | Supported column types |
---|---|---|---|
MariaDB | ✅ (docs) | Same as MySQL | All types |
MySQL | ✅ (docs) | after , first , autoIncrement , from , storedAs , storedAsJson , virtualAs , virtualAsJson , invisible , unsigned , nullable , default , charset , collation , comment , useCurrent , useCurrentOnUpdate , srid , renameTo |
All types |
PostgreSQL | ✅ (docs) | autoIncrement , from , storedAs , generatedAs , always , nullable , default , collation , comment , useCurrent , isGeometry , projection |
All types except enum |
SQLite | ❌ (docs) | N/A | N/A |
SQL Server | ✅ (docs) | autoIncrement , nullable , default , collation , persisted , useCurrent |
All types except enum |
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.