-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
Merged
Merged
[11.x] Remove Doctrine DBAL #48864
Conversation
This file contains 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
GrahamCampbell
requested changes
Oct 31, 2023
hafezdivandari
force-pushed
the
master-patch-2
branch
from
November 6, 2023 19:08
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: |
This reverts commit ba31106.
7 tasks
taylorotwell
reviewed
Jan 9, 2024
Thanks! |
Thanks @hafezdivandari! |
13 tasks
This was referenced Feb 8, 2024
This was referenced Feb 15, 2024
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.