From 6bb2439378a5895e8967911e0260542df2609e97 Mon Sep 17 00:00:00 2001 From: "Christopher C. Wells" Date: Sat, 15 May 2021 10:44:27 -0700 Subject: [PATCH] Reset migrations The extensive migration of the goals table caused unhappiness for sqlite. --- .../2021_02_13_052427_create_goals_table.php | 11 +++-- ...2021_04_30_052739_refactor_goals_table.php | 46 ------------------- 2 files changed, 7 insertions(+), 50 deletions(-) delete mode 100644 database/migrations/2021_04_30_052739_refactor_goals_table.php diff --git a/database/migrations/2021_02_13_052427_create_goals_table.php b/database/migrations/2021_02_13_052427_create_goals_table.php index a46b999..722996b 100644 --- a/database/migrations/2021_02_13_052427_create_goals_table.php +++ b/database/migrations/2021_02_13_052427_create_goals_table.php @@ -17,11 +17,14 @@ class CreateGoalsTable extends Migration Schema::create('goals', function (Blueprint $table) { $table->id(); $table->foreignIdFor(User::class)->constrained()->cascadeOnUpdate()->cascadeOnDelete(); - $table->date('from')->nullable(); - $table->date('to')->nullable(); - $table->string('frequency')->nullable(); $table->string('name'); - $table->unsignedFloat('goal'); + $table->unsignedTinyInteger('days')->nullable(); + $table->unsignedFloat('calories')->nullable(); + $table->unsignedFloat('fat')->nullable(); + $table->unsignedFloat('cholesterol')->nullable(); + $table->unsignedFloat('sodium')->nullable(); + $table->unsignedFloat('carbohydrates')->nullable(); + $table->unsignedFloat('protein')->nullable(); $table->timestamps(); $table->index('user_id'); }); diff --git a/database/migrations/2021_04_30_052739_refactor_goals_table.php b/database/migrations/2021_04_30_052739_refactor_goals_table.php deleted file mode 100644 index 9dbcada..0000000 --- a/database/migrations/2021_04_30_052739_refactor_goals_table.php +++ /dev/null @@ -1,46 +0,0 @@ -truncate(); - Schema::table('goals', function (Blueprint $table) { - $table->unsignedTinyInteger('days')->default(127)->after('name'); - $table->unsignedFloat('calories')->nullable()->after('days'); - $table->unsignedFloat('fat')->nullable()->after('calories'); - $table->unsignedFloat('cholesterol')->nullable()->after('fat'); - $table->unsignedFloat('sodium')->nullable()->after('cholesterol'); - $table->unsignedFloat('carbohydrates')->nullable()->after('sodium'); - $table->unsignedFloat('protein')->nullable()->after('carbohydrates'); - $table->dropColumn(['frequency', 'from', 'goal', 'to']); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - DB::table('goals')->truncate(); - Schema::table('goals', function (Blueprint $table) { - $table->date('from')->nullable(); - $table->date('to')->nullable(); - $table->string('frequency')->nullable(); - $table->unsignedFloat('goal')->nullable(); - $table->dropColumn(['days', 'calories', 'fat', 'cholesterol', 'sodium', 'carbohydrates', 'protein']); - }); - } -}