fitness-web/console/migrations/m151006_100909_create__table__ticket.php
2015-10-06 17:20:15 +02:00

53 lines
1.4 KiB
PHP

<?php
use yii\db\Schema;
use yii\db\Migration;
class m151006_100909_create__table__ticket 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('{{%ticket}}', [
'id_ticket' => $this->primaryKey(),
'id_user' => $this->integer(),
'id_ticket_type' => $this->integer(),
'id_account' => $this->integer(),
'id_discount' => $this->integer(),
'start' => $this->timestamp(),
'end' => $this->timestamp(),
'max_usage_count' => $this->integer(),
'usage_count' => $this->integer(),
'status' => $this->integer(),
'price_brutto' => $this->integer(),
'comment' => $this->string(255)->notNull(),
'created_at' => $this->timestamp()->notNull(),
'updated_at' => $this->timestamp()->notNull(),
], $tableOptions);
}
public function down()
{
echo "m151006_100909_create__table__ticket cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}