mirror of https://github.com/kcal-app/kcal.git
Remove temporary migrations
This commit is contained in:
parent
a9a11d3090
commit
242faeabd8
|
|
@ -1,38 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
use App\Models\User;
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
class AddMealsToUsersTable extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function up()
|
|
||||||
{
|
|
||||||
// Schema::table('users', function (Blueprint $table) {
|
|
||||||
// $table->json('meals')->nullable()->after('name');
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// User::each(function (User $user) {
|
|
||||||
// $user->meals = User::getDefaultMeals();
|
|
||||||
// $user->save();
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
// Schema::table('users', function (Blueprint $table) {
|
|
||||||
// $table->dropColumn('meals');
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
use App\Models\JournalEntry;
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
class ChangeMealToIntInJournalEntries extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function up()
|
|
||||||
{
|
|
||||||
// Schema::table('journal_entries', function (Blueprint $table) {
|
|
||||||
// $table->integer('meal_int')->unsigned()->nullable()->after('protein');
|
|
||||||
// });
|
|
||||||
// DB::update('UPDATE `journal_entries` SET meal_int =
|
|
||||||
// IF(meal = "breakfast", 0,
|
|
||||||
// IF(meal = "lunch", 1,
|
|
||||||
// IF(meal = "dinner", 2, 3)
|
|
||||||
// )
|
|
||||||
// )');
|
|
||||||
// Schema::table('journal_entries', function (Blueprint $table) {
|
|
||||||
// $table->dropColumn('meal');
|
|
||||||
// $table->renameColumn('meal_int', 'meal');
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
// Schema::table('journal_entries', function (Blueprint $table) {
|
|
||||||
// $table->renameColumn('meal', 'meal_int');
|
|
||||||
// });
|
|
||||||
// Schema::table('journal_entries', function (Blueprint $table) {
|
|
||||||
// $table->enum('meal', JournalEntry::meals()->pluck('value')->toArray())->after('protein');
|
|
||||||
// });
|
|
||||||
// DB::update('UPDATE `journal_entries` SET meal =
|
|
||||||
// IF(meal_int = 0, "breakfast",
|
|
||||||
// IF(meal_int = 1, "lunch",
|
|
||||||
// IF(meal_int = 2, "dinner", "snacks")
|
|
||||||
// )
|
|
||||||
// )');
|
|
||||||
// Schema::table('journal_entries', function (Blueprint $table) {
|
|
||||||
// $table->dropColumn('meal_int');
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue