New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[11.x] Remove Doctrine DBAL #48864
[11.x] Remove Doctrine DBAL #48864
Conversation
17a97cf
to
90d1f8a
Compare
If you are replacing DBAL in 11.x, please consider to take a look in order to find possible improvement ideas: |
I also removed I think it wasn't a good practice to keep this on the core, as we have no use case for this on the framework, and some contributions using this method may mistakenly get merge to the core in the future. However you may revert this commit if you prefer to keep this method for any reason. |
Thanks! |
Thanks @hafezdivandari! |
Finally, this PR removes Doctrine DBAL from the framework. π
New Features / Enhancements
doctrine/dbal
from the framework β‘collation
column modifier on SQLitecollation
toSchema::getColumns()
on SQLite (was alwaysnull
before)Schema::getColumns()
on SQLitedb:show
,db:table
, andmodel:show
artisan commands to use native schema methods β¨db:show
anddb:table
commands usingNumber
helper classdb:show
artisan command (PostgreSQL only)db:show
artisan command (PostgreSQL and SQL Server only)DB::getServerVersion()
to get database versionNotes
Legacy MySQL (< 8.0) and MariaDB (< 10.5.2) don't have
alter table rename column
command, so we're retrieving column's attributes and usealter table change column
command instead, just like Doctrine DBAL, but also with support for all types includingenum
,geometry
, etc.However, renaming generated columns (usingFixed on [11.x] Add support for modifying generated columnsΒ #50329.storedAs($expression)
andvirtualAs($spression)
) on these legacy DBs using$table->renameColumn()
are not supported, but there is a workaround for this using->renameTo()->change()
Due to limitations of SQLite, modifying a column on a table that has a generated column (usingFixed on [11.x] Add support for modifying generated columnsΒ #50329storedAs($expression)
andvirtualAs($spression)
) is partially supported, it's better than Doctrine DBAL that doesn't support these at all, but it's still not fully supported. A workaround is to also redeclare any existing generated column withchange()
at the end.Check List
doctrine/dbal
package when renaming columnsdoctrine/dbal
package when dropping columns on SQLitedoctrine/dbal
package when modifying columnsSchema::getColumnType()
doctrine/dbal
package when retrieving column typeSchema::getIndexes()
(added on Laravel 10.37 [10.x] Get indexes of a tableΒ #49204)doctrine/dbal
package when renaming and index on SQLiteSchema::getTables()
(added on Laravel 10.34 [10.x] Get tables and views infoΒ #49020)doctrine/dbal
package when truncating databaseSchema::getTables()
(added on Laravel 10.34 [10.x] Get tables and views infoΒ #49020)Schema::getViews()
(added on Laravel 10.34 [10.x] Get tables and views infoΒ #49020)Schema::getTypes()
(added on Laravel 10.37.1 [10.x] Get user-defined types on PostgreSQLΒ #49303)Schema::getColumns()
(added on Laravel 10.30 [10.x] Get columns of a tableΒ #48357)Schema::getIndexes()
(added on Laravel 10.37 [10.x] Get indexes of a tableΒ #49204)Schema::getForeignKeys()
(added on Laravel 10.37 [10.x] Get foreign keys of a tableΒ #49264)db:show
artisan command and removedoctrine/dbal
dependencydb:table
artisan command and removedoctrine/dbal
dependencymodel:show
artisan command and removedoctrine/dbal
dependencyChanges
DB::getServerVersion()
methodSchema::$alwaysUsesNativeSchemaOperationsIfPossible
class propertySchema::useNativeSchemaOperationsIfPossible()
methodDB::getDoctrineConnection()
and the whole\Illuminate\Database\PDO
directoryDB::usingNativeSchemaOperations()
methodDB::isDoctrineAvailable()
methodDB::getDoctrineColumn()
methodDB::getDoctrineSchemaManager()
methodDB::registerDoctrineType()
method (both\Illuminate\Database\DatabaseManager::registerDoctrineType()
and\Illuminate\Database\Connection::registerDoctrineType()
methods)database.dbal.types
config property\Illuminate\Database\DBAL\TimestampType
class\Illuminate\Database\Schema\Grammars\ChangeColumn
class\Illuminate\Database\Schema\Grammars\RenameColumn
class\Illuminate\Database\Schema\Grammars\Grammar::getDoctrineTableDiff()
methodUpgrade Guide
SQLite 3.35.0+
If your application is utilizing an SQLite database, you should update SQLite to 3.35.0+ (laravel/docs#9017).
Removal of Doctrine DBAL
You may remove
doctrine/dbal
composer dependency.Modifying Columns
As already noted on Laravel 10.x docs, When modifying a column, you must explicitly include all of the modifiers you want to keep on the column definition - any missing attribute will be dropped. For example, to retain the
unsigned
,default
, andcomment
attributes, you must call each modifier explicitly when changing the column:Schema builder
getColumnType()
methodThe
Schema::getColumnType()
method now always returns actual database type of the given column, not the doctrine equivalent type, even if you havedoctrine/dbal
installed.Registering Custom Doctrine Types
As we are not using Doctrine DBAL for modifying/renaming columns, registering custom doctrine types are not supported anymore. The
database.dbal.types
config key andDB::registerDoctrineType()
method are removed.