瀏覽代碼

fix: 🐛 Renamed Migration & changed precision on decimals to more reasonable number

IceToast 3 年之前
父節點
當前提交
5b738be6e1

+ 5 - 0
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) {
         Schema::table('products', function (Blueprint $table) {
             $table->string('billing_period')->default("hourly");
             $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"');
         DB::statement('UPDATE products SET billing_period="hourly"');
@@ -38,6 +41,8 @@ class AddBillingPeriodToProducts extends Migration
     {
     {
         Schema::table('products', function (Blueprint $table) {
         Schema::table('products', function (Blueprint $table) {
             $table->dropColumn('billing_period');
             $table->dropColumn('billing_period');
+            $table->decimal('price', 10, 0)->change();
+            $table->float('minimum_credits')->change();
         });
         });
     }
     }
 }
 }

+ 3 - 2
database/migrations/2022_06_16_094402_update_user_price_datatype.php → 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\Database\Schema\Blueprint;
 use Illuminate\Support\Facades\Schema;
 use Illuminate\Support\Facades\Schema;
 
 
-class UpdateUserPriceDatatype extends Migration
+class UpdateUserCreditsDatatype extends Migration
 {
 {
     /**
     /**
      * Run the migrations.
      * Run the migrations.
@@ -14,7 +14,7 @@ class UpdateUserPriceDatatype extends Migration
     public function up()
     public function up()
     {
     {
         Schema::table('users', function (Blueprint $table) {
         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) {
         Schema::table('users', function (Blueprint $table) {
             $table->unsignedFloat('credits')->default(250)->change();
             $table->unsignedFloat('credits')->default(250)->change();
+
         });
         });
     }
     }
 }
 }