first commit
This commit is contained in:
51
alter_wechat_merchants.php
Normal file
51
alter_wechat_merchants.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
|
||||
if (file_exists(__DIR__ . '/.env')) {
|
||||
$dotenv = Dotenv\Dotenv::createUnsafeImmutable(__DIR__);
|
||||
$dotenv->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_merchants')) {
|
||||
Capsule::schema()->create('wechat_merchants', function ($table) {
|
||||
$table->id();
|
||||
$table->string('name', 50);
|
||||
$table->string('mode', 20)->default('direct');
|
||||
$table->string('mch_id', 32);
|
||||
$table->string('app_id', 32)->nullable();
|
||||
$table->string('sub_mch_id', 32)->nullable();
|
||||
$table->string('sub_app_id', 32)->nullable();
|
||||
$table->string('service_provider', 50)->nullable();
|
||||
$table->tinyInteger('is_default')->default(0);
|
||||
$table->tinyInteger('status')->default(1);
|
||||
$table->string('remark', 255)->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['mch_id']);
|
||||
$table->index(['mode']);
|
||||
$table->index(['status']);
|
||||
$table->index(['is_default']);
|
||||
});
|
||||
echo "Table 'wechat_merchants' created successfully.\n";
|
||||
}
|
||||
|
||||
echo "Alter wechat_merchants completed.\n";
|
||||
|
||||
Reference in New Issue
Block a user