From d7c0c26f35ca6b494e8fd0c6175cce399d9d63e3 Mon Sep 17 00:00:00 2001 From: IceToast Date: Thu, 16 Jun 2022 15:33:44 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Renamed=20Migration=20&?= =?UTF-8?q?=20changed=20precision=20on=20decimals=20to=20more=20reasonable?= =?UTF-8?q?=20number?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2022_06_16_092704_add_billing_period_to_products.php | 5 +++++ ...hp => 2022_06_16_094402_update_user_credits_datatype.php} | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) rename database/migrations/{2022_06_16_094402_update_user_price_datatype.php => 2022_06_16_094402_update_user_credits_datatype.php} (82%) diff --git a/database/migrations/2022_06_16_092704_add_billing_period_to_products.php b/database/migrations/2022_06_16_092704_add_billing_period_to_products.php index 708e6e5e..ceed9362 100644 --- a/database/migrations/2022_06_16_092704_add_billing_period_to_products.php +++ b/database/migrations/2022_06_16_092704_add_billing_period_to_products.php @@ -16,6 +16,9 @@ class AddBillingPeriodToProducts extends Migration { Schema::table('products', function (Blueprint $table) { $table->string('billing_period')->default("hourly"); + $table->decimal('price', 15, 4)->change(); + $table->decimal('minimum_credits', 15, 4)->change(); + }); DB::statement('UPDATE products SET billing_period="hourly"'); @@ -38,6 +41,8 @@ class AddBillingPeriodToProducts extends Migration { Schema::table('products', function (Blueprint $table) { $table->dropColumn('billing_period'); + $table->decimal('price', 10, 0)->change(); + $table->float('minimum_credits')->change(); }); } } diff --git a/database/migrations/2022_06_16_094402_update_user_price_datatype.php b/database/migrations/2022_06_16_094402_update_user_credits_datatype.php similarity index 82% rename from database/migrations/2022_06_16_094402_update_user_price_datatype.php rename to database/migrations/2022_06_16_094402_update_user_credits_datatype.php index 9b4abb9e..ed5922e8 100644 --- a/database/migrations/2022_06_16_094402_update_user_price_datatype.php +++ b/database/migrations/2022_06_16_094402_update_user_credits_datatype.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class UpdateUserPriceDatatype extends Migration +class UpdateUserCreditsDatatype extends Migration { /** * Run the migrations. @@ -14,7 +14,7 @@ class UpdateUserPriceDatatype extends Migration public function up() { Schema::table('users', function (Blueprint $table) { - $table->decimal('credits', 20, 10)->default(0)->change(); + $table->decimal('credits', 15, 4)->default(0)->change(); }); } @@ -27,6 +27,7 @@ class UpdateUserPriceDatatype extends Migration { Schema::table('users', function (Blueprint $table) { $table->unsignedFloat('credits')->default(250)->change(); + }); } }