Ah yes, lets just spend 30 minutes trying to get a migration to run correctly.
This commit is contained in:
parent
675e780946
commit
0b3c0f6d5a
2 changed files with 4 additions and 3 deletions
|
@ -41,10 +41,11 @@ class ChangeServicesToUseAMoreUniqueIdentifier extends Migration
|
||||||
{
|
{
|
||||||
Schema::table('services', function (Blueprint $table) {
|
Schema::table('services', function (Blueprint $table) {
|
||||||
$table->dropColumn('uuid');
|
$table->dropColumn('uuid');
|
||||||
$table->string('folder')->unique('file');
|
$table->string('folder')->nullable();
|
||||||
$table->char('author', 36)->change();
|
$table->string('author', 36)->change();
|
||||||
|
|
||||||
$table->unique('name');
|
$table->unique('name');
|
||||||
|
$table->unique('folder', 'services_file_unique');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ChangeToABetterUniqueServiceConfiguration extends Migration
|
||||||
});
|
});
|
||||||
|
|
||||||
DB::transaction(function () {
|
DB::transaction(function () {
|
||||||
DB::table('service_options')->select(['id', 'author'])->get()->each(function ($option) {
|
DB::table('service_options')->select(['id', 'tag'])->get()->each(function ($option) {
|
||||||
DB::table('service_options')->where('id', $option->id)->update([
|
DB::table('service_options')->where('id', $option->id)->update([
|
||||||
'tag' => array_get(explode(':', $option->tag), 1),
|
'tag' => array_get(explode(':', $option->tag), 1),
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in a new issue