-
Notifications
You must be signed in to change notification settings - Fork 11.6k
[11.x] Remove Doctrine DBAL #48864
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
Merged
Merged
[11.x] Remove Doctrine DBAL #48864
Conversation
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
GrahamCampbell
requested changes
Oct 31, 2023
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: |
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/dbalfrom the framework β‘collationcolumn modifier on SQLitecollationtoSchema::getColumns()on SQLite (was alwaysnullbefore)Schema::getColumns()on SQLitedb:show,db:table, andmodel:showartisan commands to use native schema methods β¨db:showanddb:tablecommands usingNumberhelper classdb:showartisan command (PostgreSQL only)db:showartisan 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 columncommand, so we're retrieving column's attributes and usealter table change columncommand 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/dbalpackage when renaming columnsdoctrine/dbalpackage when dropping columns on SQLitedoctrine/dbalpackage when modifying columnsSchema::getColumnType()doctrine/dbalpackage when retrieving column typeSchema::getIndexes()(added on Laravel 10.37 [10.x] Get indexes of a tableΒ #49204)doctrine/dbalpackage when renaming and index on SQLiteSchema::getTables()(added on Laravel 10.34 [10.x] Get tables and views infoΒ #49020)doctrine/dbalpackage 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:showartisan command and removedoctrine/dbaldependencydb:tableartisan command and removedoctrine/dbaldependencymodel:showartisan command and removedoctrine/dbaldependencyChanges
DB::getServerVersion()methodSchema::$alwaysUsesNativeSchemaOperationsIfPossibleclass propertySchema::useNativeSchemaOperationsIfPossible()methodDB::getDoctrineConnection()and the whole\Illuminate\Database\PDOdirectoryDB::usingNativeSchemaOperations()methodDB::isDoctrineAvailable()methodDB::getDoctrineColumn()methodDB::getDoctrineSchemaManager()methodDB::registerDoctrineType()method (both\Illuminate\Database\DatabaseManager::registerDoctrineType()and\Illuminate\Database\Connection::registerDoctrineType()methods)database.dbal.typesconfig property\Illuminate\Database\DBAL\TimestampTypeclass\Illuminate\Database\Schema\Grammars\ChangeColumnclass\Illuminate\Database\Schema\Grammars\RenameColumnclass\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/dbalcomposer 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, andcommentattributes, 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/dbalinstalled.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.typesconfig key andDB::registerDoctrineType()method are removed.