Skip to content

Commit

Permalink
Move upgrade migrations to own tag
Browse files Browse the repository at this point in the history
  • Loading branch information
romanzipp committed Mar 15, 2024
1 parent 975059c commit 454f084
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ The easiest way to execute tests locally is via [**Lando**](https://lando.dev/).
```shell
lando start

lando phpunit-sqlite
lando phpunit-mysql
lando phpunit-postgres
```
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateQueueMonitorTable extends Migration
{
public function up()
{
Schema::create(config('queue-monitor.table'), function (Blueprint $table) {
$table->increments('id');

$table->string('job_id')->index();
$table->string('name')->nullable();
$table->string('queue')->nullable();

$table->timestamp('started_at')->nullable()->index();
$table->string('started_at_exact')->nullable();

$table->timestamp('finished_at')->nullable();
$table->string('finished_at_exact')->nullable();

$table->float('time_elapsed', 12, 6)->nullable()->index();

$table->boolean('failed')->default(false)->index();

$table->integer('attempt')->default(0);
$table->integer('progress')->nullable();

$table->longText('exception')->nullable();
$table->text('exception_message')->nullable();
$table->text('exception_class')->nullable();

$table->longText('data')->nullable();
});
}

public function down()
{
Schema::drop(config('queue-monitor.table'));
}
}
10 changes: 6 additions & 4 deletions migrations/2018_02_05_000000_create_queue_monitor_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,31 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use romanzipp\QueueMonitor\Enums\MonitorStatus;

class CreateQueueMonitorTable extends Migration
{
public function up()
{
Schema::create(config('queue-monitor.table'), function (Blueprint $table) {
$table->increments('id');
$table->uuid('job_uuid')->nullable();

$table->string('job_id')->index();
$table->string('name')->nullable();
$table->string('queue')->nullable();

$table->unsignedInteger('status')->default(MonitorStatus::RUNNING);

$table->dateTime('queued_at')->nullable();
$table->timestamp('started_at')->nullable()->index();
$table->string('started_at_exact')->nullable();

$table->timestamp('finished_at')->nullable();
$table->string('finished_at_exact')->nullable();

$table->float('time_elapsed', 12, 6)->nullable()->index();

$table->boolean('failed')->default(false)->index();

$table->integer('attempt')->default(0);
$table->boolean('retried')->default(false);
$table->integer('progress')->nullable();

$table->longText('exception')->nullable();
Expand Down
4 changes: 4 additions & 0 deletions src/Providers/QueueMonitorProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public function boot(): void
__DIR__ . '/../../migrations' => database_path('migrations'),
], 'migrations');

$this->publishes([
__DIR__ . '/../../migrations-upgrade' => base_path('migrations-upgrade'),
], 'migrations-upgrade');

$this->publishes([
__DIR__ . '/../../views' => resource_path('views/vendor/queue-monitor'),
], 'views');
Expand Down

1 comment on commit 454f084

@jonnott
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How should this work for 5.2.0 in terms of the core Laravel change in 11.x regarding the ->float() field type?

I've just removed the further arguments from ->float() in the create and update migrations for queue-monitor.table during my Laravel 11 upgrade..

Please sign in to comment.