load(); } $capsule = new Capsule; $capsule->addConnection([ 'driver' => 'mysql', 'host' => $_ENV['DB_HOST'] ?? '127.0.0.1', 'port' => $_ENV['DB_PORT'] ?? '3306', 'database' => $_ENV['DB_DATABASE'] ?? '', 'username' => $_ENV['DB_USERNAME'] ?? '', 'password' => $_ENV['DB_PASSWORD'] ?? '', 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', ]); $capsule->setAsGlobal(); $capsule->bootEloquent(); if (!Capsule::schema()->hasTable('wechat_apps')) { Capsule::schema()->create('wechat_apps', function ($table) { $table->id(); $table->string('name', 50); $table->string('type', 20)->default('h5'); $table->string('app_id', 32)->unique(); $table->string('app_secret', 64)->nullable(); $table->tinyInteger('status')->default(1); $table->string('remark', 255)->nullable(); $table->timestamps(); $table->index(['type']); $table->index(['status']); }); echo "Table 'wechat_apps' created successfully.\n"; } echo "Alter wechat_apps completed.\n";