Skip to content

Commit

Permalink
update migration
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Dec 14, 2023
1 parent 6b9fcad commit 4d3b6f7
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions database/migrations/2023_06_07_000001_create_pulse_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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');
}
};

0 comments on commit 4d3b6f7

Please sign in to comment.