mirror of https://github.com/kcal-app/kcal.git
Remove development migrations
This commit is contained in:
parent
8db02e302b
commit
678f944af1
|
|
@ -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']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -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');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -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']);
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue