Remove development migrations

This commit is contained in:
Christopher C. Wells 2021-03-13 14:38:02 -08:00
parent 8db02e302b
commit 678f944af1
3 changed files with 0 additions and 114 deletions

View File

@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddTimesToRecipes extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('recipes', function (Blueprint $table) {
$table->integer('time_prep')->nullable()->after('description');
$table->integer('time_active')->nullable()->after('time_prep');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('recipes', function (Blueprint $table) {
$table->dropColumn(['time_prep', 'time_active']);
});
}
}

View File

@ -1,45 +0,0 @@
<?php
use App\Models\Recipe;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddDescriptionDeltaToRecipes extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('recipes', function (Blueprint $table) {
$table->longText('description_delta')->nullable()->after('description');
});
foreach (Recipe::all() as $recipe) {
if (empty($recipe->description)) {
continue;
}
// Format as a basic Quill Delta.
// See: https://quilljs.com/docs/delta/
$delta = ['ops' => [['insert' => "{$recipe->description}\n"]]];
$recipe->description_delta = json_encode($delta);
$recipe->save();
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('recipes', function (Blueprint $table) {
$table->dropColumn('description_delta');
});
}
}

View File

@ -1,36 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class ReplaceActiveTimeWithCookTimeInRecipes extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('recipes', function (Blueprint $table) {
$table->integer('time_cook')->nullable()->after('time_prep');
});
DB::update("UPDATE `recipes` SET `time_cook` = `time_active`;");
Schema::table('recipes', function (Blueprint $table) {
$table->dropColumn(['time_active']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('recipes', function (Blueprint $table) {
$table->dropColumn(['time_cook']);
});
}
}