Skip to content
Snippets Groups Projects
m171204_135754_create_table_videoconf_users_mm.php 1.56 KiB
Newer Older
  • Learn to ignore specific revisions
  • Marcello Pivanti's avatar
    Marcello Pivanti committed
    <?php
    /**
    
     * Copyright 2020 Art-ER S. Cons. P.A.
     * EROI - Emilia Romagna Open Innovation is based on:
     * https://www.open2.0.regione.lombardia.it
    
    Marcello Pivanti's avatar
    Marcello Pivanti committed
     *
    
     * @see http://example.com Developers'community
    
     * @license GPLv3
     * @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
    
    Marcello Pivanti's avatar
    Marcello Pivanti committed
     *
    
    waltermazza's avatar
    waltermazza committed
     * @package    arter\amos\videoconference\migrations
    
    Marcello Pivanti's avatar
    Marcello Pivanti committed
     * @category   CategoryName
     * @author     Elite Division S.r.l.
     */
    
    
    waltermazza's avatar
    waltermazza committed
    use arter\amos\core\migration\AmosMigrationTableCreation;
    
    Marcello Pivanti's avatar
    Marcello Pivanti committed
    
    /**
     * Class m171204_135754_create_table_videoconf_users_mm
     */
    class m171204_135754_create_table_videoconf_users_mm extends AmosMigrationTableCreation
    {
        /**
         * @inheritdoc
         */
        protected function setTableName()
        {
            $this->tableName = '{{%videoconf_users_mm}}';
        }
    
        /**
         * @inheritdoc
         */
        protected function setTableFields()
        {
            $this->tableFields = [
                'id' => $this->primaryKey(),
                'videoconf_id' => $this->integer()->notNull(),
                'user_profile_id' => $this->integer()->notNull()
            ];
        }
    
        /**
         * @inheritdoc
         */
        protected function beforeTableCreation()
        {
            parent::beforeTableCreation();
            $this->setAddCreatedUpdatedFields(true);
        }
    
        /**
         * @inheritdoc
         */
        protected function addForeignKeys()
        {
            $this->addForeignKey('fk_videoconf_users_mm', $this->getRawTableName(), 'videoconf_id', '{{%videoconf}}', 'id');
            $this->addForeignKey('fk_users_videoconf_mm', $this->getRawTableName(), 'user_profile_id', '{{%user_profile}}', 'id');
        }
    }