feat(lottery): 扩展传统马来赔率、玩法结算与开注商短码支持
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('bet_providers', function (Blueprint $table): void {
|
||||
$table->string('short_code', 1)->nullable()->after('name');
|
||||
});
|
||||
|
||||
DB::table('bet_providers')->orderBy('id')->get(['id', 'code'])->each(function (object $provider): void {
|
||||
DB::table('bet_providers')
|
||||
->where('id', $provider->id)
|
||||
->update(['short_code' => strtoupper(substr((string) $provider->code, 0, 1))]);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('bet_providers', function (Blueprint $table): void {
|
||||
$table->dropColumn('short_code');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user