m180220_172009_create_call_table.php 1.32 KB
<?php
    
    use yii\db\Migration;
    
    /**
     * Class m180203_131720_call_table
     */
    class m180220_172009_create_call_table extends Migration
    {
        /**
         * @inheritdoc
         */
        public function safeUp()
        {
            $this->createTable(
                'call',
                [
                    'id'       => $this->primaryKey(),
                    'company'  => $this->string()
                                       ->notNull(),
                    'calldate' => 'timestamp NOT NULL',
                    'callerid' => $this->string()
                                       ->notNull(),
                    'line'     => $this->string(),
                    'operator' => $this->string(),
                    'status'   => $this->string()
                                       ->notNull(),
                    'queue'    => $this->string(),
                    'duration' => $this->integer()
                                       ->notNull(),
                    'billsec'  => $this->integer()
                                       ->notNull(),
                    'record'   => $this->string(),
                ]
            );
        }
        
        /**
         * @inheritdoc
         */
        public function safeDown()
        {
            $this->dropTable('call');
        }
    }