mirror of
https://github.com/humhub/humhub.git
synced 2025-03-14 20:19:47 +01:00
🎨 Code Style for Migration
This commit is contained in:
parent
0d60f80a6f
commit
14d4a590b7
@ -1,15 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* @link https://www.humhub.org/
|
||||
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
|
||||
* @license https://www.humhub.com/licences
|
||||
*/
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
class m170118_111823_queuetable extends Migration
|
||||
{
|
||||
|
||||
public $tableName = '{{%queue}}';
|
||||
public $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
|
||||
|
||||
public function up()
|
||||
{
|
||||
$tableOptions = null;
|
||||
if ($this->db->driverName === 'mysql') {
|
||||
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
|
||||
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
|
||||
}
|
||||
|
||||
$this->createTable($this->tableName, [
|
||||
'id' => $this->primaryKey(),
|
||||
'channel' => $this->string()->notNull(),
|
||||
@ -17,7 +26,7 @@ class m170118_111823_queuetable extends Migration
|
||||
'created_at' => $this->integer()->notNull(),
|
||||
'started_at' => $this->integer(),
|
||||
'finished_at' => $this->integer(),
|
||||
], $this->tableOptions);
|
||||
], $tableOptions);
|
||||
|
||||
$this->createIndex('channel', $this->tableName, 'channel');
|
||||
$this->createIndex('started_at', $this->tableName, 'started_at');
|
||||
@ -27,5 +36,4 @@ class m170118_111823_queuetable extends Migration
|
||||
{
|
||||
$this->dropTable($this->tableName);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,19 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* @link https://www.humhub.org/
|
||||
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
|
||||
* @license https://www.humhub.com/licences
|
||||
*/
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
class m170307_170300_queuelater extends Migration
|
||||
{
|
||||
public $tableName = '{{%queue}}';
|
||||
|
||||
public function up()
|
||||
{
|
||||
$this->addColumn('queue', 'timeout', $this->integer()->defaultValue(0)->notNull()->after('created_at'));
|
||||
$this->addColumn($this->tableName, 'timeout', $this->integer()->defaultValue(0)->notNull()->after('created_at'));
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m170307_170300_queuelater cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,15 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @link https://www.humhub.org/
|
||||
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
|
||||
* @license https://www.humhub.com/licences
|
||||
*/
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
class m171025_142030_queue_update extends Migration
|
||||
{
|
||||
|
||||
public $tableName = '{{%queue}}';
|
||||
|
||||
public function safeUp()
|
||||
{
|
||||
$this->dropTable($this->tableName);
|
||||
$this->createTable($this->tableName, [
|
||||
'id' => $this->primaryKey(),
|
||||
'channel' => $this->string()->notNull(),
|
||||
@ -34,19 +37,4 @@ class m171025_142030_queue_update extends Migration
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use up()/down() to run migration code without a transaction.
|
||||
public function up()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m171025_142030_queue_update cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
@ -1,18 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* @link https://www.humhub.org/
|
||||
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
|
||||
* @license https://www.humhub.com/licences
|
||||
*/
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
class m171027_220519_exclusive_jobs extends Migration
|
||||
{
|
||||
public $tableName = '{{queue_exclusive}}';
|
||||
|
||||
public function safeUp()
|
||||
{
|
||||
$this->createTable('{{queue_exclusive}}', [
|
||||
$this->createTable($this->tableName, [
|
||||
'id' => $this->string(50)->notNull(),
|
||||
'job_message_id' => $this->string(50),
|
||||
'job_status' => $this->smallInteger()->defaultValue(2),
|
||||
'last_update' => $this->timestamp()
|
||||
]);
|
||||
$this->addPrimaryKey('pk_queue_exclusive', '{{queue_exclusive}}', 'id');
|
||||
$this->addPrimaryKey('pk_queue_exclusive', $this->tableName, 'id');
|
||||
}
|
||||
|
||||
public function safeDown()
|
||||
@ -21,19 +28,4 @@ class m171027_220519_exclusive_jobs extends Migration
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use up()/down() to run migration code without a transaction.
|
||||
public function up()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m171027_220519_exclusive_jobs cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user