Skip to content

Commit

Permalink
Clean up this migration so it runs forwards and backwards OK
Browse files Browse the repository at this point in the history
  • Loading branch information
uberbrady committed Oct 5, 2023
1 parent 5a7aa52 commit 6459dd0
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use App\Models\Asset;
use App\Models\DefaultValuesForCustomFields;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Expand All @@ -14,9 +16,16 @@ class AddTypeColumnToDefaultValuesForCustomFields extends Migration
public function up()
{
Schema::table('default_values_for_custom_fields', function (Blueprint $table) {
$table->text('type')->default('App\\Models\\Asset');
$table->renameColumn('asset_model_id','item_pivot_id');
$table->string('type')->nullable();
$table->renameColumn('asset_model_id','item_pivot_id'); //this one works. okay. that's someting.
//$table->text('type')->nullable(false)->change();
});
DefaultValuesForCustomFields::query()->update(['type' => Asset::class]);
Schema::table('default_values_for_custom_fields', function (Blueprint $table) {
//$table->renameColumn('asset_model_id','item_pivot_id'); //this one works. okay. that's someting.
$table->string('type')->nullable(false)->change();
});

}

/**
Expand Down

0 comments on commit 6459dd0

Please sign in to comment.