37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?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('orders')) {
|
|
if (!Capsule::schema()->hasColumn('orders', 'express_modify_count')) {
|
|
Capsule::schema()->table('orders', function ($table) {
|
|
$table->tinyInteger('express_modify_count')->default(0)->after('express_no');
|
|
});
|
|
echo "Added 'express_modify_count' to orders.\n";
|
|
} else {
|
|
echo "'express_modify_count' already exists.\n";
|
|
}
|
|
}
|