From 4d3b6f766c579ee56b8da10f3402157d71cbf7a3 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 14 Dec 2023 10:09:07 -0600 Subject: [PATCH] update migration --- .../2023_06_07_000001_create_pulse_tables.php | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/database/migrations/2023_06_07_000001_create_pulse_tables.php b/database/migrations/2023_06_07_000001_create_pulse_tables.php index 156ff225..c6e87554 100644 --- a/database/migrations/2023_06_07_000001_create_pulse_tables.php +++ b/database/migrations/2023_06_07_000001_create_pulse_tables.php @@ -8,19 +8,15 @@ return new class extends Migration { - /** - * Get the migration connection name. - */ - public function getConnection(): ?string - { - return Config::get('pulse.storage.database.connection'); - } - /** * Run the migrations. */ public function up(): void { + if (! $this->shouldRun()) { + return; + } + $connection = DB::connection($this->getConnection()); Schema::create('pulse_values', function (Blueprint $table) use ($connection) { @@ -89,4 +85,20 @@ public function down(): void Schema::dropIfExists('pulse_entries'); Schema::dropIfExists('pulse_aggregates'); } + + /** + * Get the migration connection name. + */ + public function getConnection(): ?string + { + return Config::get('pulse.storage.database.connection'); + } + + /** + * Determine if the migration should run. + */ + public function shouldRun(): bool + { + return ! App::environment('testing') || config('pulse.enabled'); + } };