改进 迁移

This commit is contained in:
iVampireSP.com 2023-01-14 18:17:03 +08:00
parent c6d943291a
commit cfae9acb42
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132
2 changed files with 2 additions and 34 deletions

View File

@ -15,8 +15,8 @@ public function up(): void
{
Schema::table('hosts', function (Blueprint $table) {
// 将 price 和 managed_price 改成 decimal
$table->decimal('price')->change();
$table->decimal('managed_price')->change();
$table->decimal('price', 10)->change();
$table->decimal('managed_price', 10)->change();
});
}

View File

@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->decimal('balance')->default(0)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->decimal('balance', 10)->default(0)->change();
});
}
};