Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] Support DB configurations that _require_ a unique ID #142

Merged
merged 5 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions UPGRADE.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Upgrade Guide

# Beta to 1.x

- [Auto-incrementing IDs were added to Pulse's tables](https://github.com/laravel/pulse/pull/142). This is recommended if you are using a configuration that requires tables to have a unique key on every table, e.g., PlanetScale.

3 changes: 3 additions & 0 deletions database/migrations/2023_06_07_000001_create_pulse_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function up(): void
{
Schema::create('pulse_values', function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->id();
$table->unsignedInteger('timestamp');
$table->string('type');
$table->text('key');
Expand All @@ -35,6 +36,7 @@ public function up(): void

Schema::create('pulse_entries', function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->id();
$table->unsignedInteger('timestamp');
$table->string('type');
$table->text('key');
Expand All @@ -49,6 +51,7 @@ public function up(): void

Schema::create('pulse_aggregates', function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->id();
$table->unsignedInteger('bucket');
$table->unsignedMediumInteger('period');
$table->string('type');
Expand Down
4 changes: 4 additions & 0 deletions tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
expect()->extend('toContainAggregateForAllPeriods', function (string|array $type, string $aggregate, string $key, int $value, int $count = null, int $timestamp = null) {
$this->toBeInstanceOf(Collection::class);

$values = $this->value->each(function (stdClass $value) {
unset($value->id);
});

$types = (array) $type;
$timestamp ??= now()->timestamp;

Expand Down