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

This commit is contained in:
IceToast 2022-06-16 15:33:44 +02:00
parent 6c93343200
commit d7c0c26f35
2 changed files with 8 additions and 2 deletions

View file

@ -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();
});
}
}

View file

@ -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();
});
}
}