Add migrations to queue database tables
This commit is contained in:
parent
f4a9615b51
commit
0e4d05d150
|
|
@ -36,7 +36,7 @@
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"fzaninotto/faker": "~1.4",
|
"fzaninotto/faker": "~1.4",
|
||||||
"phpunit/phpunit": "~4.0",
|
"phpunit/phpunit": "~5.7",
|
||||||
"phpunit/phpunit-selenium": "~1.2"
|
"phpunit/phpunit-selenium": "~1.2"
|
||||||
},
|
},
|
||||||
"autoload-dev": {
|
"autoload-dev": {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use October\Rain\Database\Schema\Blueprint;
|
||||||
|
use October\Rain\Database\Updates\Migration;
|
||||||
|
|
||||||
|
class DbSystemSessionsUpdate extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('sessions', function (Blueprint $table) {
|
||||||
|
$table->unsignedInteger('user_id')->nullable();
|
||||||
|
$table->string('ip_address', 45)->nullable();
|
||||||
|
$table->text('user_agent')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use October\Rain\Database\Schema\Blueprint;
|
||||||
|
use October\Rain\Database\Updates\Migration;
|
||||||
|
|
||||||
|
class DbJobsFailedJobsUpdate extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table($this->getTableName(), function (Blueprint $table) {
|
||||||
|
$table->dropColumn('reserved');
|
||||||
|
$table->index(['queue', 'reserved_at']);
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table($this->getFailedTableName(), function (Blueprint $table) {
|
||||||
|
$table->longText('exception')->nullable()->after('payload');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table($this->getTableName(), function (Blueprint $table) {
|
||||||
|
$table->tinyInteger('reserved')->unsigned();
|
||||||
|
$table->dropIndex('jobs_queue_reserved_at_index');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table($this->getFailedTableName(), function (Blueprint $table) {
|
||||||
|
$table->dropColumn('exception');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getTableName()
|
||||||
|
{
|
||||||
|
return Config::get('queue.connections.database.table', 'jobs');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getFailedTableName()
|
||||||
|
{
|
||||||
|
return Config::get('queue.failed.table', 'failed_jobs');
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue