id(); $table->string('scope_code', 32)->unique(); $table->json('platforms'); $table->boolean('enabled')->default(false)->index(); $table->dateTime('starts_at'); $table->dateTime('ends_at')->nullable(); $table->string('timezone', 64); $table->timestamps(); }); Schema::create('maintenance_translations', function (Blueprint $table) { $table->id(); $table->unsignedBigInteger('maintenance_id'); $table->string('language', 8); $table->text('content'); $table->unique(['maintenance_id', 'language']); $table->foreign('maintenance_id')->references('id')->on('maintenance_settings')->onDelete('cascade'); }); // Fixed scopes. Deployment must never start maintenance on its own. $now = gmdate('Y-m-d H:i:s'); foreach (['site', 'third:1', 'third:2', 'third:3', 'third:4', 'third:5', 'third:6', 'third:7', 'self:sport', 'self:lottery'] as $scope) { DB::table('maintenance_settings')->insert(['scope_code' => $scope, 'platforms' => '["PC","H5","APP"]', 'enabled' => false, 'starts_at' => $now, 'ends_at' => null, 'timezone' => 'Asia/Shanghai', 'created_at' => $now, 'updated_at' => $now]); } } public function down(): void { Schema::dropIfExists('maintenance_translations'); Schema::dropIfExists('maintenance_settings'); } };