Skip to content

Commit eb58fb2

Browse files
[9.x] Remove Doctrine DBAL from prerequisites of renaming/dropping column (#8396)
* remove Doctrine DBAL from prerequisites of renaming/dropping column * formatting Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent 21b95cd commit eb58fb2

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

migrations.md

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- [Available Column Types](#available-column-types)
1616
- [Column Modifiers](#column-modifiers)
1717
- [Modifying Columns](#modifying-columns)
18+
- [Renaming Columns](#renaming-columns)
1819
- [Dropping Columns](#dropping-columns)
1920
- [Indexes](#indexes)
2021
- [Creating Indexes](#creating-indexes)
@@ -1056,21 +1057,31 @@ We could also modify a column to be nullable:
10561057
> The following column types can be modified: `bigInteger`, `binary`, `boolean`, `char`, `date`, `dateTime`, `dateTimeTz`, `decimal`, `double`, `integer`, `json`, `longText`, `mediumText`, `smallInteger`, `string`, `text`, `time`, `tinyText`, `unsignedBigInteger`, `unsignedInteger`, `unsignedSmallInteger`, and `uuid`. To modify a `timestamp` column type a [Doctrine type must be registered](#prerequisites).
10571058
10581059
<a name="renaming-columns"></a>
1059-
#### Renaming Columns
1060+
### Renaming Columns
10601061

1061-
To rename a column, you may use the `renameColumn` method provided by the schema builder blueprint. Before renaming a column, ensure that you have installed the `doctrine/dbal` library via the Composer package manager:
1062+
To rename a column, you may use the `renameColumn` method provided by the schema builder:
10621063

10631064
Schema::table('users', function (Blueprint $table) {
10641065
$table->renameColumn('from', 'to');
10651066
});
10661067

1067-
> **Warning**
1068-
> Renaming an `enum` column is not currently supported.
1068+
<a name="renaming-columns-on-legacy-databases"></a>
1069+
#### Renaming Columns On Legacy Databases
1070+
1071+
If you are running a database installation older than one of the following releases, you should ensure that you have installed the `doctrine/dbal` library via the Composer package manager before renaming a column:
1072+
1073+
<div class="content-list" markdown="1">
1074+
1075+
- MySQL < `8.0.3`
1076+
- MariaDB < `10.5.2`
1077+
- SQLite < `3.25.0`
1078+
1079+
</div>
10691080

10701081
<a name="dropping-columns"></a>
10711082
### Dropping Columns
10721083

1073-
To drop a column, you may use the `dropColumn` method on the schema builder blueprint. If your application is utilizing an SQLite database, you must install the `doctrine/dbal` package via the Composer package manager before the `dropColumn` method may be used:
1084+
To drop a column, you may use the `dropColumn` method on the schema builder:
10741085

10751086
Schema::table('users', function (Blueprint $table) {
10761087
$table->dropColumn('votes');
@@ -1082,8 +1093,11 @@ You may drop multiple columns from a table by passing an array of column names t
10821093
$table->dropColumn(['votes', 'avatar', 'location']);
10831094
});
10841095

1085-
> **Warning**
1086-
> Dropping or modifying multiple columns within a single migration while using an SQLite database is not supported.
1096+
1097+
<a name="dropping-columns-on-legacy-databases"></a>
1098+
#### Dropping Columns On Legacy Databases
1099+
1100+
If you are running a version of SQLite prior to `3.35.0`, you must install the `doctrine/dbal` package via the Composer package manager before the `dropColumn` method may be used. Dropping or modifying multiple columns within a single migration while using this package is not supported.
10871101

10881102
<a name="available-command-aliases"></a>
10891103
#### Available Command Aliases
@@ -1167,6 +1181,9 @@ To rename an index, you may use the `renameIndex` method provided by the schema
11671181

11681182
$table->renameIndex('from', 'to')
11691183

1184+
> **Warning**
1185+
> If your application is utilizing an SQLite database, you must install the `doctrine/dbal` package via the Composer package manager before the `renameIndex` method may be used.
1186+
11701187
<a name="dropping-indexes"></a>
11711188
### Dropping Indexes
11721189

0 commit comments

Comments
 (0)