Expand size of decimal fields

Fixed #37
This commit is contained in:
Christopher C. Wells 2021-10-31 19:37:58 -07:00
parent 6dd301a296
commit f607bf73f7
1 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class FixDecimalFieldsPrecision extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('foods', function (Blueprint $table) {
$table->decimal('serving_size', 14, 8)->unsigned()->change();
});
Schema::table('recipes', function (Blueprint $table) {
$table->decimal('volume', 14, 8)->unsigned()->nullable()->change();
});
Schema::table('ingredient_amounts', function (Blueprint $table) {
$table->decimal('amount', 14, 8)->unsigned()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('foods', function (Blueprint $table) {
$table->decimal('serving_size', 10, 8)->unsigned()->change();
});
Schema::table('recipes', function (Blueprint $table) {
$table->decimal('volume', 10, 8)->unsigned()->nullable()->change();
});
Schema::table('ingredient_amounts', function (Blueprint $table) {
$table->decimal('amount', 10, 8)->unsigned()->change();
});
}
}