Skip to content

Commit 3e43a0e

Browse files
[11.x] Schema Upgrade Guide (#9268)
* wip * formatting * formatting * formatting --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent f5947e2 commit 3e43a0e

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed

upgrade.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@
99

1010
- [Updating Dependencies](#updating-dependencies)
1111
- [Updating Minimum Stability](#updating-minimum-stability)
12+
- [SQLite Minimum Version](#sqlite-minimum-version)
13+
14+
</div>
15+
16+
<a name="medium-impact-changes"></a>
17+
## Medium Impact Changes
18+
19+
<div class="content-list" markdown="1">
20+
21+
- [Modifying Columns](#modifying-columns)
22+
- [Floating-Point Types](#floating-point-types)
1223

1324
</div>
1425

@@ -19,6 +30,7 @@
1930

2031
- [The `Enumerable` Contract](#the-enumerable-contract)
2132
- [Spatial Types](#spatial-types)
33+
- [Doctrine DBAL Removal](#doctrine-dbal-removal)
2234

2335
</div>
2436

@@ -50,6 +62,8 @@ You should update the following dependencies in your application's `composer.jso
5062

5163
</div>
5264

65+
In addition, you may remove the `doctrine/dbal` Composer dependency if you have previously added it to your application, as Laravel is no longer dependent on this package.
66+
5367
<a name="collections"></a>
5468
### Collections
5569

@@ -67,6 +81,53 @@ public function dump(...$args);
6781
<a name="database"></a>
6882
### Database
6983

84+
<a name="sqlite-minimum-version"></a>
85+
#### SQLite 3.35.0+
86+
87+
**Likelihood Of Impact: High**
88+
89+
If your application is utilizing an SQLite database, SQLite 3.35.0 or greater is required.
90+
91+
<a name="modifying-columns"></a>
92+
#### Modifying Columns
93+
94+
**Likelihood Of Impact: Medium**
95+
96+
When modifying a column, you must now explicitly include all the modifiers you want to keep on the column definition after it is changed. Any missing attributes will be dropped. For example, to retain the `unsigned`, `default`, and `comment` attributes, you must call each modifier explicitly when changing the column, even if those attributes have been assigned to the column by a previous migration:
97+
98+
```php
99+
Schema::table('users', function (Blueprint $table) {
100+
$table->integer('votes')->unsigned()->default(1)->comment('my comment')->change();
101+
});
102+
```
103+
104+
<a name="floating-point-types"></a>
105+
#### Floating-Point Types
106+
107+
**Likelihood Of Impact: Medium**
108+
109+
The `double` and `float` migration column types have been rewritten to be consistent across all databases.
110+
111+
The `double` column type now creates a `DOUBLE` equivalent column without total digits and places (digits after decimal point), which is the standard SQL syntax. Therefore, you may remove the arguments for `$total` and `$places`:
112+
113+
```php
114+
$table->double('amount');
115+
```
116+
117+
The `float` column type now creates a `FLOAT` equivalent column without total digits and places (digits after decimal point), but with an optional `$precision` specification to determine storage size as a 4-byte single-precision column or an 8-byte double-precision column. Therefore, you may remove the arguments for `$total` and `$places` and specify the optional `$precision` to your desired value and according to your database's documentation:
118+
119+
```php
120+
$table->float('amount', precision: 53);
121+
```
122+
123+
The `unsignedDecimal`, `unsignedDouble`, and `unsignedFloat` methods have been removed, as the unsigned modifier for these column types has been deprecated by MySQL, and was never standardized on other database systems. However, if you wish to continue using the deprecated unsigned attribute for these column types, you may chain the `unsigned` method onto the column's definition:
124+
125+
```php
126+
$table->decimal('amount', total: 8, places: 2)->unsigned();
127+
$table->double('amount')->unsigned();
128+
$table->float('amount', precision: 53)->unsigned();
129+
```
130+
70131
<a name="spatial-types"></a>
71132
#### Spatial Types
72133

@@ -87,3 +148,39 @@ $table->geography('latitude', subtype: 'point', srid: 4326);
87148
```
88149

89150
The `isGeometry` and `projection` column modifiers of the PostgreSQL grammar have been removed accordingly.
151+
152+
<a name="doctrine-dbal-removal"></a>
153+
#### Doctrine DBAL Removal
154+
155+
**Likelihood Of Impact: Low**
156+
157+
The following list of Doctrine DBAL related classes and methods have been removed. Laravel is no longer dependent on this package and registering custom Doctrines types is no longer necessary for the proper creation and alteration of various column types that previously required custom types:
158+
159+
<div class="content-list" markdown="1">
160+
161+
- `Illuminate\Database\Schema\Builder::$alwaysUsesNativeSchemaOperationsIfPossible` class property
162+
- `Illuminate\Database\Schema\Builder::useNativeSchemaOperationsIfPossible()` method
163+
- `Illuminate\Database\Connection::usingNativeSchemaOperations()` method
164+
- `Illuminate\Database\Connection::isDoctrineAvailable()` method
165+
- `Illuminate\Database\Connection::getDoctrineConnection()` method
166+
- `Illuminate\Database\Connection::getDoctrineSchemaManager()` method
167+
- `Illuminate\Database\Connection::getDoctrineColumn()` method
168+
- `Illuminate\Database\Connection::registerDoctrineType()` method
169+
- `Illuminate\Database\DatabaseManager::registerDoctrineType()` method
170+
- `Illuminate\Database\PDO` directory
171+
- `Illuminate\Database\DBAL\TimestampType` class
172+
- `Illuminate\Database\Schema\Grammars\ChangeColumn` class
173+
- `Illuminate\Database\Schema\Grammars\RenameColumn` class
174+
- `Illuminate\Database\Schema\Grammars\Grammar::getDoctrineTableDiff()` method
175+
176+
</div>
177+
178+
In addition, registering custom Doctrine types via `dbal.types` in your application's `database` configuration file is no longer required.
179+
180+
<a name="get-column-types"></a>
181+
#### Schema Builder `getColumnType()` Method
182+
183+
**Likelihood Of Impact: Very Low**
184+
185+
The `Schema::getColumnType()` method now always returns actual type of the given column, not the Doctrine DBAL equivalent type.
186+

0 commit comments

Comments
 (0)