| 12345678910111213141516171819202122 |
- <?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::create('recharge_method_logos', function (Blueprint $t) {
- $t->string('channel_type', 100)->primary(); $t->string('logo', 2048)->nullable(); $t->timestamps();
- });
- if (Schema::hasColumn('recharge_channel', 'logo')) {
- foreach (DB::table('recharge_channel')->where('data_type', 1)->whereNull('deleted_at')->whereNotNull('logo')->where('logo', '<>', '')->orderBy('sort')->orderBy('id')->get() as $channel) {
- DB::table('recharge_method_logos')->insertOrIgnore(['channel_type' => $channel->type, 'logo' => $channel->logo,
- 'created_at' => now(), 'updated_at' => now()]);
- }
- }
- }
- public function down(): void { Schema::dropIfExists('recharge_method_logos'); }
- };
|