Skip to content

Commit

Permalink
Update 2023_06_07_000001_create_pulse_tables.php
Browse files Browse the repository at this point in the history
Minor change for a slightly clearer implementation.
  • Loading branch information
mralston authored Dec 7, 2023
1 parent 644321a commit 34ab767
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions database/migrations/2023_06_07_000001_create_pulse_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public function up(): void
match ($driver = $connection->getDriverName()) {
'mysql' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'),
'pgsql' => $table->uuid('key_hash')->storedAs('md5("key")::uuid'),
default => App::environment('testing') ? $table->char('key_hash', 16) : throw new RuntimeException("Unsupported database driver [{$driver}]."),
'sqlite' => App::environment('testing') ? $table->char('key_hash', 16) : throw new RuntimeException("Unsupported database driver [{$driver}].")
default => throw new RuntimeException("Unsupported database driver [{$driver}]."),
};
$table->text('value');

Expand All @@ -48,7 +49,8 @@ public function up(): void
match ($driver = $connection->getDriverName()) {
'mysql' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'),
'pgsql' => $table->uuid('key_hash')->storedAs('md5("key")::uuid'),
default => App::environment('testing') ? $table->char('key_hash', 16) : throw new RuntimeException("Unsupported database driver [{$driver}]."),
'sqlite' => App::environment('testing') ? $table->char('key_hash', 16) : throw new RuntimeException("Unsupported database driver [{$driver}].")
default => throw new RuntimeException("Unsupported database driver [{$driver}]."),
};
$table->bigInteger('value')->nullable();

Expand All @@ -67,7 +69,8 @@ public function up(): void
match ($driver = $connection->getDriverName()) {
'mysql' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'),
'pgsql' => $table->uuid('key_hash')->storedAs('md5("key")::uuid'),
default => App::environment('testing') ? $table->char('key_hash', 16) : throw new RuntimeException("Unsupported database driver [{$driver}]."),
'sqlite' => App::environment('testing') ? $table->char('key_hash', 16) : throw new RuntimeException("Unsupported database driver [{$driver}].")
default => throw new RuntimeException("Unsupported database driver [{$driver}]."),
};
$table->string('aggregate');
$table->decimal('value', 20, 2);
Expand Down

0 comments on commit 34ab767

Please sign in to comment.