fitness-web/console/migrations/m160124_135213_add__table__contract.php
2016-01-25 01:43:19 +01:00

51 lines
1.3 KiB
PHP

<?php
use yii\db\Schema;
use yii\db\Migration;
class m160124_135213_add__table__contract extends Migration
{
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('{{%contract}}', [
'id_contract' => $this->primaryKey(),
'id_user' => $this->integer(11),
'id_customer' => $this->integer(11),
'status' => $this->integer(11),
'flag' => $this->integer(11),
'part_paid' => $this->integer(11),
'part_count' => $this->integer(11),
'part_required' => $this->integer(11),
'expired_at' => $this->dateTime()->notNull(),
'created_at' => $this->dateTime()->notNull(),
'updated_at' => $this->dateTime()->notNull(),
], $tableOptions);
$this->addColumn("ticket", "id_contract", "int");
$this->addColumn("ticket_installment_request", "id_contract", "int");
}
public function down()
{
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}