35 lines
850 B
PHP
35 lines
850 B
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class AddCategories extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::table("images", function(Blueprint $table) {
|
|
$table->uuidMorphs("imageable");
|
|
});
|
|
Schema::table("images", function(Blueprint $table) {
|
|
DB::table("images")->update(['imageable_id'=>DB::raw('`product_uuid`')], ['imageable_type' => "App\Models\Product"]);
|
|
$table->dropConstrainedForeignId("product_uuid");
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
// Ehh don't wanna bother
|
|
}
|
|
}
|