Skip to content

Commit 0b3c0f6

Browse files
committed
Ah yes, lets just spend 30 minutes trying to get a migration to run correctly.
1 parent 675e780 commit 0b3c0f6

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

database/migrations/2017_10_02_202000_ChangeServicesToUseAMoreUniqueIdentifier.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ public function down()
4141
{
4242
Schema::table('services', function (Blueprint $table) {
4343
$table->dropColumn('uuid');
44-
$table->string('folder')->unique('file');
45-
$table->char('author', 36)->change();
44+
$table->string('folder')->nullable();
45+
$table->string('author', 36)->change();
4646

4747
$table->unique('name');
48+
$table->unique('folder', 'services_file_unique');
4849
});
4950
}
5051
}

database/migrations/2017_10_02_202007_ChangeToABetterUniqueServiceConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function down()
4949
});
5050

5151
DB::transaction(function () {
52-
DB::table('service_options')->select(['id', 'author'])->get()->each(function ($option) {
52+
DB::table('service_options')->select(['id', 'tag'])->get()->each(function ($option) {
5353
DB::table('service_options')->where('id', $option->id)->update([
5454
'tag' => array_get(explode(':', $option->tag), 1),
5555
]);

0 commit comments

Comments
 (0)