Skip to content

Commit ab866a9

Browse files
committed
#9425 Fix default values on upgrade for PostgreSQL and MySQL too (redux)
1 parent 7d479bc commit ab866a9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

classes/migration/upgrade/v3_5_0/I9425_SeparateUIAndSubmissionLocales.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ public function up(): void
107107
$localeColumns->each(function ($column) use ($tableName, $isPostgres) {
108108
$default = match($isPostgres) {
109109
// PostgreSQL describes defaults in terms like: 'en'::character varying
110-
// If there is a '-delimited string part, fetch and use it.
111-
true => empty($column['default']) ? null : strtok($column['default'], "'"),
110+
// If there is a '-delimited string part, fetch and use it. If it's just
111+
// "::character varying", it was an empty string.
112+
true => empty($column['default']) ? null : explode("'", $column['default'])[1],
112113
false => $column['default'],
113114
};
114115
Schema::table($tableName, fn (Blueprint $table) => $table->string($column['name'], 28)->nullable($column['nullable'])->default($default)->change());

0 commit comments

Comments
 (0)