| @@ -42,7 +42,13 @@ abstract class BaseCommand extends Command | |||||
| try { | try { | ||||
| $ret = $this->service(); | $ret = $this->service(); | ||||
| } catch (Exception $e) { | } catch (Exception $e) { | ||||
| $message = sprintf("例外発生:%s:%s:%d", $e->getMessage(), $e->getFile(), $e->getLine()); | |||||
| $message = sprintf( | |||||
| "例外発生:%s:%s:%s:%d", | |||||
| get_class($e), | |||||
| $e->getMessage(), | |||||
| $e->getFile(), | |||||
| $e->getLine() | |||||
| ); | |||||
| $this->outputError($message, $e->getTrace()); | $this->outputError($message, $e->getTrace()); | ||||
| $ret = self::RESULTCODE_FAILED; | $ret = self::RESULTCODE_FAILED; | ||||
| } | } | ||||
| @@ -0,0 +1,108 @@ | |||||
| <?php | |||||
| namespace App\Console\Commands\Migration; | |||||
| use App\Codes\EnvironmentName; | |||||
| use App\Console\Commands\BaseCommand; | |||||
| use App\Models\Htpms\MstCustomer; | |||||
| use App\Models\HtpmsCustomer\Existing\Parking; | |||||
| use App\Models\HtpmsCustomer\HtpmsCustomerConnectionSwitch; | |||||
| use Exception; | |||||
| use Illuminate\Database\QueryException; | |||||
| use Illuminate\Support\Facades\DB; | |||||
| class 全顧客マイグレーション extends BaseCommand | |||||
| { | |||||
| const COMMAND = "migrate:customer-all"; | |||||
| /** | |||||
| * The name and signature of the console command. | |||||
| * | |||||
| * @var string | |||||
| */ | |||||
| protected $signature = self::COMMAND; | |||||
| /** | |||||
| * The console command description. | |||||
| * | |||||
| * @var string | |||||
| */ | |||||
| protected $description = '全顧客毎テーブルをマイグレーションする'; | |||||
| static public function getCommand() | |||||
| { | |||||
| return self::COMMAND; | |||||
| } | |||||
| /** | |||||
| * Create a new command instance. | |||||
| * | |||||
| * @return void | |||||
| */ | |||||
| public function __construct() | |||||
| { | |||||
| parent::__construct(); | |||||
| } | |||||
| /** | |||||
| * Execute the console command. | |||||
| * | |||||
| * @return int | |||||
| */ | |||||
| public function service(): int | |||||
| { | |||||
| if (!app()->environment([EnvironmentName::PRODUCTOIN->value])) { | |||||
| $this->outputWarn("本番環境でないため、520以外はスキップします"); | |||||
| } | |||||
| $customers = MstCustomer::query() | |||||
| ->orderBy(MstCustomer::COL_NAME_ID) | |||||
| ->get(); | |||||
| foreach ($customers as $customer) { | |||||
| $this->handleCustomer($customer); | |||||
| } | |||||
| return self::RESULTCODE_SUCCESS; | |||||
| } | |||||
| private function handleCustomer(MstCustomer $customer) | |||||
| { | |||||
| // 本番環境のみ全顧客をマイグレーションする | |||||
| if (!app()->environment([EnvironmentName::PRODUCTOIN->value])) { | |||||
| if ( | |||||
| $customer->id !== 520 | |||||
| ) { | |||||
| return; | |||||
| } | |||||
| } | |||||
| // ## 暫定的に対象を絞り中 テスト中 | |||||
| if (!in_array($customer->id, [1, 520], true)) { | |||||
| return; | |||||
| } | |||||
| if (!HtpmsCustomerConnectionSwitch::isEnable($customer->id)) { | |||||
| $this->outputWarn(sprintf("存在しないスキーマのためスキップ htpms_%d (%s:%s)", $customer->id, $customer->customer_name, $customer->customer_id)); | |||||
| return; | |||||
| } | |||||
| HtpmsCustomerConnectionSwitch::switch($customer->id); | |||||
| try { | |||||
| $this->outputInfo(sprintf("start htpms_%d migration (%s:%s) ", $customer->id, $customer->customer_name, $customer->customer_id)); | |||||
| $this->call("migrate", ["--force" => true]); | |||||
| $this->outputInfo(sprintf("end htpms_%d migration (%s:%s)", $customer->id, $customer->customer_name, $customer->customer_id)); | |||||
| } catch (Exception $e) { | |||||
| print_r(DB::getConfig()); | |||||
| throw $e; | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -2,12 +2,19 @@ | |||||
| namespace App\Models\HtpmsCustomer; | namespace App\Models\HtpmsCustomer; | ||||
| use Illuminate\Support\Facades\DB; | |||||
| use Exception; | |||||
| use Illuminate\Support\Facades\Config; | |||||
| use PDO; | |||||
| class HtpmsCustomerConnectionSwitch | class HtpmsCustomerConnectionSwitch | ||||
| { | { | ||||
| public static function switch(int $customerId): void | public static function switch(int $customerId): void | ||||
| { | { | ||||
| if (!self::isEnable($customerId)) { | |||||
| throw new Exception("顧客切り替え不正"); | |||||
| } | |||||
| $connectionsRoot = "database.connections"; | $connectionsRoot = "database.connections"; | ||||
| $connectionHtmsCustomer = "htpms_customer"; | $connectionHtmsCustomer = "htpms_customer"; | ||||
| @@ -17,9 +24,26 @@ class HtpmsCustomerConnectionSwitch | |||||
| $afterDatabaseName = "htpms_{$customerId}"; | $afterDatabaseName = "htpms_{$customerId}"; | ||||
| if ($currentDatabaseName !== $afterDatabaseName) { | if ($currentDatabaseName !== $afterDatabaseName) { | ||||
| $conf = [$databaseNameKey => $afterDatabaseName]; | |||||
| config($conf); | |||||
| DB::reconnect($connectionHtmsCustomer); | |||||
| Config::set($databaseNameKey, $afterDatabaseName); | |||||
| } | |||||
| } | |||||
| public static function isEnable(int $customerId): bool | |||||
| { | |||||
| $dsn = sprintf( | |||||
| 'pgsql:dbname=htpms_%d host=%s port=%d', | |||||
| $customerId, | |||||
| config("database.connections.htpms_customer.host"), | |||||
| config("database.connections.htpms_customer.port"), | |||||
| ); | |||||
| $user = config("database.connections.htpms_customer.username"); | |||||
| $password = config("database.connections.htpms_customer.password"); | |||||
| try { | |||||
| new PDO($dsn, $user, $password); | |||||
| } catch (Exception $e) { | |||||
| return false; | |||||
| } | } | ||||
| return true; | |||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,55 @@ | |||||
| <?php | |||||
| namespace App\Util; | |||||
| use Exception; | |||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Nette\NotImplementedException; | |||||
| abstract class MigrationEx extends Migration | |||||
| { | |||||
| public function up(): void | |||||
| { | |||||
| if (!$this->connection) { | |||||
| throw new Exception("connection 未定義"); | |||||
| } | |||||
| // 共通スキーマの変更は社内テスト(520)の場合のみ行う | |||||
| if ($this->connection === "htpms") { | |||||
| if (config("database.connections.htpms_customer.database") !== "htpms_520") { | |||||
| printf("htpms スキップ\n"); | |||||
| return; | |||||
| } | |||||
| } | |||||
| $this->runUp(); | |||||
| } | |||||
| public function down(): void | |||||
| { | |||||
| if (!$this->connection) { | |||||
| throw new Exception("connection 未定義"); | |||||
| } | |||||
| // 共通スキーマの変更は社内テスト(520)の場合のみ行う | |||||
| if ($this->connection === "htpms") { | |||||
| if (config("database.connections.htpms_customer.database") !== "htpms_520") { | |||||
| printf("htpms スキップ\n"); | |||||
| return; | |||||
| } | |||||
| } | |||||
| $this->runDown(); | |||||
| } | |||||
| protected function runUp(): void | |||||
| { | |||||
| throw new NotImplementedException(); | |||||
| } | |||||
| protected function runDown(): void | |||||
| { | |||||
| throw new NotImplementedException(); | |||||
| } | |||||
| }; | |||||
| @@ -1,18 +1,18 @@ | |||||
| <?php | <?php | ||||
| use App\Models\ColumnName; | use App\Models\ColumnName; | ||||
| use App\Util\MigrationEx; | |||||
| use App\Util\MigrationHelper; | use App\Util\MigrationHelper; | ||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
| return new class extends Migration | |||||
| return new class extends MigrationEx | |||||
| { | { | ||||
| protected $connection = "htpms"; | protected $connection = "htpms"; | ||||
| /** | /** | ||||
| * Run the migrations. | * Run the migrations. | ||||
| */ | */ | ||||
| public function up(): void | |||||
| protected function runUp(): void | |||||
| { | { | ||||
| $schema = function (Blueprint $table, MigrationHelper $helper) { | $schema = function (Blueprint $table, MigrationHelper $helper) { | ||||
| $helper->baseColumn() | $helper->baseColumn() | ||||
| @@ -40,7 +40,7 @@ return new class extends Migration | |||||
| /** | /** | ||||
| * Reverse the migrations. | * Reverse the migrations. | ||||
| */ | */ | ||||
| public function down(): void | |||||
| public function runDown(): void | |||||
| { | { | ||||
| Schema::dropIfExists('tbl3_mst_users'); | Schema::dropIfExists('tbl3_mst_users'); | ||||
| Schema::dropIfExists('tbl3_mst_user_histories'); | Schema::dropIfExists('tbl3_mst_user_histories'); | ||||
| @@ -1,17 +1,17 @@ | |||||
| <?php | <?php | ||||
| use App\Util\MigrationEx; | |||||
| use App\Util\MigrationHelper; | use App\Util\MigrationHelper; | ||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
| return new class extends Migration | |||||
| return new class extends MigrationEx | |||||
| { | { | ||||
| protected $connection = "htpms"; | protected $connection = "htpms"; | ||||
| /** | /** | ||||
| * Run the migrations. | * Run the migrations. | ||||
| */ | */ | ||||
| public function up(): void | |||||
| protected function runUp(): void | |||||
| { | { | ||||
| $schema = function (Blueprint $table, MigrationHelper $helper) { | $schema = function (Blueprint $table, MigrationHelper $helper) { | ||||
| $table->id()->comment("失敗したジョブの"); | $table->id()->comment("失敗したジョブの"); | ||||
| @@ -29,7 +29,7 @@ return new class extends Migration | |||||
| /** | /** | ||||
| * Reverse the migrations. | * Reverse the migrations. | ||||
| */ | */ | ||||
| public function down(): void | |||||
| protected function runDown(): void | |||||
| { | { | ||||
| Schema::dropIfExists('tbl3_failed_jobs'); | Schema::dropIfExists('tbl3_failed_jobs'); | ||||
| } | } | ||||
| @@ -1,18 +1,18 @@ | |||||
| <?php | <?php | ||||
| use App\Util\MigrationEx; | |||||
| use App\Util\MigrationHelper; | use App\Util\MigrationHelper; | ||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
| return new class extends Migration | |||||
| return new class extends MigrationEx | |||||
| { | { | ||||
| protected $connection = "htpms"; | protected $connection = "htpms"; | ||||
| /** | /** | ||||
| * Run the migrations. | * Run the migrations. | ||||
| */ | */ | ||||
| public function up(): void | |||||
| protected function runUp(): void | |||||
| { | { | ||||
| $schema = function (Blueprint $table, MigrationHelper $helper) { | $schema = function (Blueprint $table, MigrationHelper $helper) { | ||||
| @@ -31,7 +31,7 @@ return new class extends Migration | |||||
| /** | /** | ||||
| * Reverse the migrations. | * Reverse the migrations. | ||||
| */ | */ | ||||
| public function down(): void | |||||
| protected function runDown(): void | |||||
| { | { | ||||
| Schema::dropIfExists('tbl3_jobs'); | Schema::dropIfExists('tbl3_jobs'); | ||||
| } | } | ||||
| @@ -1,18 +1,18 @@ | |||||
| <?php | <?php | ||||
| use App\Util\MigrationEx; | |||||
| use App\Util\MigrationHelper; | use App\Util\MigrationHelper; | ||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
| return new class extends Migration | |||||
| return new class extends MigrationEx | |||||
| { | { | ||||
| protected $connection = "htpms_customer"; | protected $connection = "htpms_customer"; | ||||
| /** | /** | ||||
| * Run the migrations. | * Run the migrations. | ||||
| */ | */ | ||||
| public function up(): void | |||||
| protected function runUp(): void | |||||
| { | { | ||||
| $schema = function (Blueprint $table, MigrationHelper $helper) { | $schema = function (Blueprint $table, MigrationHelper $helper) { | ||||
| @@ -34,7 +34,7 @@ return new class extends Migration | |||||
| /** | /** | ||||
| * Reverse the migrations. | * Reverse the migrations. | ||||
| */ | */ | ||||
| public function down(): void | |||||
| protected function runDown(): void | |||||
| { | { | ||||
| Schema::dropIfExists('tbl3_mst_shops'); | Schema::dropIfExists('tbl3_mst_shops'); | ||||
| Schema::dropIfExists('tbl3_mst_shop_histories'); | Schema::dropIfExists('tbl3_mst_shop_histories'); | ||||
| @@ -1,19 +1,19 @@ | |||||
| <?php | <?php | ||||
| use App\Models\ColumnName; | use App\Models\ColumnName; | ||||
| use App\Util\MigrationEx; | |||||
| use App\Util\MigrationHelper; | use App\Util\MigrationHelper; | ||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
| return new class extends Migration | |||||
| return new class extends MigrationEx | |||||
| { | { | ||||
| protected $connection = "htpms_customer"; | protected $connection = "htpms_customer"; | ||||
| /** | /** | ||||
| * Run the migrations. | * Run the migrations. | ||||
| */ | */ | ||||
| public function up(): void | |||||
| protected function runUp(): void | |||||
| { | { | ||||
| $schema = function (Blueprint $table, MigrationHelper $helper) { | $schema = function (Blueprint $table, MigrationHelper $helper) { | ||||
| @@ -30,7 +30,7 @@ return new class extends Migration | |||||
| /** | /** | ||||
| * Reverse the migrations. | * Reverse the migrations. | ||||
| */ | */ | ||||
| public function down(): void | |||||
| protected function runDown(): void | |||||
| { | { | ||||
| Schema::dropIfExists('tbl3_dep_deposits'); | Schema::dropIfExists('tbl3_dep_deposits'); | ||||
| } | } | ||||
| @@ -1,19 +1,19 @@ | |||||
| <?php | <?php | ||||
| use App\Models\ColumnName; | use App\Models\ColumnName; | ||||
| use App\Util\MigrationEx; | |||||
| use App\Util\MigrationHelper; | use App\Util\MigrationHelper; | ||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
| return new class extends Migration | |||||
| return new class extends MigrationEx | |||||
| { | { | ||||
| protected $connection = "htpms_customer"; | protected $connection = "htpms_customer"; | ||||
| /** | /** | ||||
| * Run the migrations. | * Run the migrations. | ||||
| */ | */ | ||||
| public function up(): void | |||||
| protected function runUp(): void | |||||
| { | { | ||||
| $schema = function (Blueprint $table, MigrationHelper $helper) { | $schema = function (Blueprint $table, MigrationHelper $helper) { | ||||
| @@ -35,7 +35,7 @@ return new class extends Migration | |||||
| /** | /** | ||||
| * Reverse the migrations. | * Reverse the migrations. | ||||
| */ | */ | ||||
| public function down(): void | |||||
| protected function runDown(): void | |||||
| { | { | ||||
| Schema::dropIfExists('tbl3_dep_deposit_transfers'); | Schema::dropIfExists('tbl3_dep_deposit_transfers'); | ||||
| } | } | ||||
| @@ -1,19 +1,19 @@ | |||||
| <?php | <?php | ||||
| use App\Models\ColumnName; | use App\Models\ColumnName; | ||||
| use App\Util\MigrationEx; | |||||
| use App\Util\MigrationHelper; | use App\Util\MigrationHelper; | ||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
| return new class extends Migration | |||||
| return new class extends MigrationEx | |||||
| { | { | ||||
| protected $connection = "htpms_customer"; | protected $connection = "htpms_customer"; | ||||
| /** | /** | ||||
| * Run the migrations. | * Run the migrations. | ||||
| */ | */ | ||||
| public function up(): void | |||||
| protected function runUp(): void | |||||
| { | { | ||||
| $schema = function (Blueprint $table, MigrationHelper $helper) { | $schema = function (Blueprint $table, MigrationHelper $helper) { | ||||
| @@ -35,7 +35,7 @@ return new class extends Migration | |||||
| /** | /** | ||||
| * Reverse the migrations. | * Reverse the migrations. | ||||
| */ | */ | ||||
| public function down(): void | |||||
| protected function runDown(): void | |||||
| { | { | ||||
| Schema::dropIfExists('tbl3_qrs_certification_available_settings'); | Schema::dropIfExists('tbl3_qrs_certification_available_settings'); | ||||
| Schema::dropIfExists('tbl3_qrs_certification_available_setting_histories'); | Schema::dropIfExists('tbl3_qrs_certification_available_setting_histories'); | ||||
| @@ -1,20 +1,19 @@ | |||||
| <?php | <?php | ||||
| use App\Models\ColumnName; | use App\Models\ColumnName; | ||||
| use App\Util\MigrationEx; | |||||
| use App\Util\MigrationHelper; | use App\Util\MigrationHelper; | ||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\DB; | |||||
| use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
| return new class extends Migration | |||||
| return new class extends MigrationEx | |||||
| { | { | ||||
| protected $connection = "htpms_customer"; | protected $connection = "htpms_customer"; | ||||
| /** | /** | ||||
| * Run the migrations. | * Run the migrations. | ||||
| */ | */ | ||||
| public function up(): void | |||||
| protected function runUp(): void | |||||
| { | { | ||||
| $schema = function (Blueprint $table, MigrationHelper $helper) { | $schema = function (Blueprint $table, MigrationHelper $helper) { | ||||
| @@ -33,7 +32,7 @@ return new class extends Migration | |||||
| /** | /** | ||||
| * Reverse the migrations. | * Reverse the migrations. | ||||
| */ | */ | ||||
| public function down(): void | |||||
| protected function runDown(): void | |||||
| { | { | ||||
| Schema::dropIfExists('tbl3_qrs_acquisition_available_settings'); | Schema::dropIfExists('tbl3_qrs_acquisition_available_settings'); | ||||
| Schema::dropIfExists('tbl3_qrs_acquisition_available_setting_histories'); | Schema::dropIfExists('tbl3_qrs_acquisition_available_setting_histories'); | ||||
| @@ -1,20 +1,19 @@ | |||||
| <?php | <?php | ||||
| use App\Models\ColumnName; | use App\Models\ColumnName; | ||||
| use App\Util\MigrationEx; | |||||
| use App\Util\MigrationHelper; | use App\Util\MigrationHelper; | ||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\DB; | |||||
| use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
| return new class extends Migration | |||||
| return new class extends MigrationEx | |||||
| { | { | ||||
| protected $connection = "htpms_customer"; | protected $connection = "htpms_customer"; | ||||
| /** | /** | ||||
| * Run the migrations. | * Run the migrations. | ||||
| */ | */ | ||||
| public function up(): void | |||||
| protected function runUp(): void | |||||
| { | { | ||||
| $schema = function (Blueprint $table, MigrationHelper $helper) { | $schema = function (Blueprint $table, MigrationHelper $helper) { | ||||
| @@ -33,7 +32,7 @@ return new class extends Migration | |||||
| /** | /** | ||||
| * Reverse the migrations. | * Reverse the migrations. | ||||
| */ | */ | ||||
| public function down(): void | |||||
| protected function runDown(): void | |||||
| { | { | ||||
| Schema::dropIfExists('tbl3_mst_shop_no_relations'); | Schema::dropIfExists('tbl3_mst_shop_no_relations'); | ||||
| Schema::dropIfExists('tbl3_mst_shop_no_relation_histories'); | Schema::dropIfExists('tbl3_mst_shop_no_relation_histories'); | ||||
| @@ -1,20 +1,18 @@ | |||||
| <?php | <?php | ||||
| use App\Models\ColumnName; | |||||
| use App\Util\MigrationEx; | |||||
| use App\Util\MigrationHelper; | use App\Util\MigrationHelper; | ||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\DB; | |||||
| use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
| return new class extends Migration | |||||
| return new class extends MigrationEx | |||||
| { | { | ||||
| protected $connection = "htpms_customer"; | protected $connection = "htpms_customer"; | ||||
| /** | /** | ||||
| * Run the migrations. | * Run the migrations. | ||||
| */ | */ | ||||
| public function up(): void | |||||
| protected function runUp(): void | |||||
| { | { | ||||
| $schema = function (Blueprint $table, MigrationHelper $helper) { | $schema = function (Blueprint $table, MigrationHelper $helper) { | ||||
| @@ -30,7 +28,7 @@ return new class extends Migration | |||||
| /** | /** | ||||
| * Reverse the migrations. | * Reverse the migrations. | ||||
| */ | */ | ||||
| public function down(): void | |||||
| protected function runDown(): void | |||||
| { | { | ||||
| Schema::dropIfExists('tbl3_qrs_service_parking_groups'); | Schema::dropIfExists('tbl3_qrs_service_parking_groups'); | ||||
| Schema::dropIfExists('tbl3_qrs_service_parking_group_histories'); | Schema::dropIfExists('tbl3_qrs_service_parking_group_histories'); | ||||
| @@ -1,20 +1,19 @@ | |||||
| <?php | <?php | ||||
| use App\Models\ColumnName; | use App\Models\ColumnName; | ||||
| use App\Util\MigrationEx; | |||||
| use App\Util\MigrationHelper; | use App\Util\MigrationHelper; | ||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\DB; | |||||
| use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
| return new class extends Migration | |||||
| return new class extends MigrationEx | |||||
| { | { | ||||
| protected $connection = "htpms_customer"; | protected $connection = "htpms_customer"; | ||||
| /** | /** | ||||
| * Run the migrations. | * Run the migrations. | ||||
| */ | */ | ||||
| public function up(): void | |||||
| protected function runUp(): void | |||||
| { | { | ||||
| $schema = function (Blueprint $table, MigrationHelper $helper) { | $schema = function (Blueprint $table, MigrationHelper $helper) { | ||||
| @@ -32,7 +31,7 @@ return new class extends Migration | |||||
| /** | /** | ||||
| * Reverse the migrations. | * Reverse the migrations. | ||||
| */ | */ | ||||
| public function down(): void | |||||
| protected function runDown(): void | |||||
| { | { | ||||
| Schema::dropIfExists('tbl3_qrs_service_parking_group_relations'); | Schema::dropIfExists('tbl3_qrs_service_parking_group_relations'); | ||||
| Schema::dropIfExists('tbl3_qrs_service_parking_group_relation_histories'); | Schema::dropIfExists('tbl3_qrs_service_parking_group_relation_histories'); | ||||
| @@ -1,20 +1,19 @@ | |||||
| <?php | <?php | ||||
| use App\Models\ColumnName; | use App\Models\ColumnName; | ||||
| use App\Util\MigrationEx; | |||||
| use App\Util\MigrationHelper; | use App\Util\MigrationHelper; | ||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\DB; | |||||
| use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
| return new class extends Migration | |||||
| return new class extends MigrationEx | |||||
| { | { | ||||
| protected $connection = "htpms_customer"; | protected $connection = "htpms_customer"; | ||||
| /** | /** | ||||
| * Run the migrations. | * Run the migrations. | ||||
| */ | */ | ||||
| public function up(): void | |||||
| protected function runUp(): void | |||||
| { | { | ||||
| $schema = function (Blueprint $table, MigrationHelper $helper) { | $schema = function (Blueprint $table, MigrationHelper $helper) { | ||||
| @@ -51,7 +50,7 @@ return new class extends Migration | |||||
| /** | /** | ||||
| * Reverse the migrations. | * Reverse the migrations. | ||||
| */ | */ | ||||
| public function down(): void | |||||
| protected function runDown(): void | |||||
| { | { | ||||
| Schema::dropIfExists('tbl3_qrs_certification_tickets'); | Schema::dropIfExists('tbl3_qrs_certification_tickets'); | ||||
| } | } | ||||
| @@ -1,20 +1,19 @@ | |||||
| <?php | <?php | ||||
| use App\Models\ColumnName; | use App\Models\ColumnName; | ||||
| use App\Util\MigrationEx; | |||||
| use App\Util\MigrationHelper; | use App\Util\MigrationHelper; | ||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\DB; | |||||
| use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
| return new class extends Migration | |||||
| return new class extends MigrationEx | |||||
| { | { | ||||
| protected $connection = "htpms_customer"; | protected $connection = "htpms_customer"; | ||||
| /** | /** | ||||
| * Run the migrations. | * Run the migrations. | ||||
| */ | */ | ||||
| public function up(): void | |||||
| protected function runUp(): void | |||||
| { | { | ||||
| $schema = function (Blueprint $table, MigrationHelper $helper) { | $schema = function (Blueprint $table, MigrationHelper $helper) { | ||||
| @@ -51,7 +50,7 @@ return new class extends Migration | |||||
| /** | /** | ||||
| * Reverse the migrations. | * Reverse the migrations. | ||||
| */ | */ | ||||
| public function down(): void | |||||
| protected function runDown(): void | |||||
| { | { | ||||
| Schema::dropIfExists('tbl3_qrs_print_tickets'); | Schema::dropIfExists('tbl3_qrs_print_tickets'); | ||||
| } | } | ||||
| @@ -1,19 +1,19 @@ | |||||
| <?php | <?php | ||||
| use App\Models\ColumnName; | use App\Models\ColumnName; | ||||
| use App\Util\MigrationEx; | |||||
| use App\Util\MigrationHelper; | use App\Util\MigrationHelper; | ||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
| return new class extends Migration | |||||
| return new class extends MigrationEx | |||||
| { | { | ||||
| protected $connection = "htpms_customer"; | protected $connection = "htpms_customer"; | ||||
| /** | /** | ||||
| * Run the migrations. | * Run the migrations. | ||||
| */ | */ | ||||
| public function up(): void | |||||
| protected function runUp(): void | |||||
| { | { | ||||
| $schema = function (Blueprint $table, MigrationHelper $helper) { | $schema = function (Blueprint $table, MigrationHelper $helper) { | ||||
| @@ -50,7 +50,7 @@ return new class extends Migration | |||||
| /** | /** | ||||
| * Reverse the migrations. | * Reverse the migrations. | ||||
| */ | */ | ||||
| public function down(): void | |||||
| protected function runDown(): void | |||||
| { | { | ||||
| Schema::dropIfExists('tbl3_qrs_acquisition_tickets'); | Schema::dropIfExists('tbl3_qrs_acquisition_tickets'); | ||||
| } | } | ||||
| @@ -1,19 +1,19 @@ | |||||
| <?php | <?php | ||||
| use App\Models\ColumnName; | use App\Models\ColumnName; | ||||
| use App\Util\MigrationEx; | |||||
| use App\Util\MigrationHelper; | use App\Util\MigrationHelper; | ||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
| return new class extends Migration | |||||
| return new class extends MigrationEx | |||||
| { | { | ||||
| protected $connection = "htpms_customer"; | protected $connection = "htpms_customer"; | ||||
| /** | /** | ||||
| * Run the migrations. | * Run the migrations. | ||||
| */ | */ | ||||
| public function up(): void | |||||
| protected function runUp(): void | |||||
| { | { | ||||
| $schema = function (Blueprint $table, MigrationHelper $helper) { | $schema = function (Blueprint $table, MigrationHelper $helper) { | ||||
| @@ -32,7 +32,7 @@ return new class extends Migration | |||||
| /** | /** | ||||
| * Reverse the migrations. | * Reverse the migrations. | ||||
| */ | */ | ||||
| public function down(): void | |||||
| protected function runDown(): void | |||||
| { | { | ||||
| Schema::dropIfExists('tbl3_qrs_acquisition_ticket_tokens'); | Schema::dropIfExists('tbl3_qrs_acquisition_ticket_tokens'); | ||||
| } | } | ||||
| @@ -1,19 +1,18 @@ | |||||
| <?php | <?php | ||||
| use App\Models\ColumnName; | |||||
| use App\Util\MigrationEx; | |||||
| use App\Util\MigrationHelper; | use App\Util\MigrationHelper; | ||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
| return new class extends Migration | |||||
| return new class extends MigrationEx | |||||
| { | { | ||||
| protected $connection = "htpms_customer"; | protected $connection = "htpms_customer"; | ||||
| /** | /** | ||||
| * Run the migrations. | * Run the migrations. | ||||
| */ | */ | ||||
| public function up(): void | |||||
| protected function runUp(): void | |||||
| { | { | ||||
| $schema = function (Blueprint $table, MigrationHelper $helper) { | $schema = function (Blueprint $table, MigrationHelper $helper) { | ||||
| @@ -26,7 +25,7 @@ return new class extends Migration | |||||
| /** | /** | ||||
| * Reverse the migrations. | * Reverse the migrations. | ||||
| */ | */ | ||||
| public function down(): void | |||||
| protected function runDown(): void | |||||
| { | { | ||||
| Schema::table('tbl3_dep_deposit_transfers', function (Blueprint $table) { | Schema::table('tbl3_dep_deposit_transfers', function (Blueprint $table) { | ||||
| if (Schema::hasColumn($table->getTable(), "transfer_reason")) { | if (Schema::hasColumn($table->getTable(), "transfer_reason")) { | ||||
| @@ -2,20 +2,20 @@ | |||||
| use App\Codes\Model\QRServiceUsage; | use App\Codes\Model\QRServiceUsage; | ||||
| use App\Models\ColumnName; | use App\Models\ColumnName; | ||||
| use App\Util\MigrationEx; | |||||
| use App\Util\MigrationHelper; | use App\Util\MigrationHelper; | ||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\DB; | use Illuminate\Support\Facades\DB; | ||||
| use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
| return new class extends Migration | |||||
| return new class extends MigrationEx | |||||
| { | { | ||||
| protected $connection = "htpms_customer"; | protected $connection = "htpms_customer"; | ||||
| /** | /** | ||||
| * Run the migrations. | * Run the migrations. | ||||
| */ | */ | ||||
| public function up(): void | |||||
| protected function runUp(): void | |||||
| { | { | ||||
| // バックアップ | // バックアップ | ||||
| $backup = DB::connection($this->connection)->table("tbl3_mst_shop_no_relations")->get(); | $backup = DB::connection($this->connection)->table("tbl3_mst_shop_no_relations")->get(); | ||||
| @@ -67,7 +67,7 @@ return new class extends Migration | |||||
| /** | /** | ||||
| * Reverse the migrations. | * Reverse the migrations. | ||||
| */ | */ | ||||
| public function down(): void | |||||
| protected function runDown(): void | |||||
| { | { | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -1,20 +1,19 @@ | |||||
| <?php | <?php | ||||
| use App\Models\ColumnName; | use App\Models\ColumnName; | ||||
| use App\Util\MigrationEx; | |||||
| use App\Util\MigrationHelper; | use App\Util\MigrationHelper; | ||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\DB; | |||||
| use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
| return new class extends Migration | |||||
| return new class extends MigrationEx | |||||
| { | { | ||||
| protected $connection = "htpms_customer"; | protected $connection = "htpms_customer"; | ||||
| /** | /** | ||||
| * Run the migrations. | * Run the migrations. | ||||
| */ | */ | ||||
| public function up(): void | |||||
| protected function runUp(): void | |||||
| { | { | ||||
| $schema = function (Blueprint $table, MigrationHelper $helper) { | $schema = function (Blueprint $table, MigrationHelper $helper) { | ||||
| @@ -51,7 +50,7 @@ return new class extends Migration | |||||
| /** | /** | ||||
| * Reverse the migrations. | * Reverse the migrations. | ||||
| */ | */ | ||||
| public function down(): void | |||||
| protected function runDown(): void | |||||
| { | { | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -1,19 +1,19 @@ | |||||
| <?php | <?php | ||||
| use App\Models\ColumnName; | use App\Models\ColumnName; | ||||
| use App\Util\MigrationEx; | |||||
| use App\Util\MigrationHelper; | use App\Util\MigrationHelper; | ||||
| use Illuminate\Database\Migrations\Migration; | |||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
| return new class extends Migration | |||||
| return new class extends MigrationEx | |||||
| { | { | ||||
| protected $connection = "htpms_customer"; | protected $connection = "htpms_customer"; | ||||
| /** | /** | ||||
| * Run the migrations. | * Run the migrations. | ||||
| */ | */ | ||||
| public function up(): void | |||||
| protected function runUp(): void | |||||
| { | { | ||||
| $schema = function (Blueprint $table, MigrationHelper $helper) { | $schema = function (Blueprint $table, MigrationHelper $helper) { | ||||
| @@ -37,7 +37,7 @@ return new class extends Migration | |||||
| /** | /** | ||||
| * Reverse the migrations. | * Reverse the migrations. | ||||
| */ | */ | ||||
| public function down(): void | |||||
| public function runDown(): void | |||||
| { | { | ||||
| } | } | ||||
| }; | }; | ||||