stevotvr/phpbb-groupsub

View on GitHub
migrations/version_0_2_0.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php
/**
 *
 * Group Subscription. An extension for the phpBB Forum Software package.
 *
 * @copyright (c) 2018, Steve Guidetti, https://github.com/stevotvr
 * @license GNU General Public License, version 2 (GPL-2.0)
 *
 */

namespace stevotvr\groupsub\migrations;

use phpbb\db\migration\migration;

/**
 * Group Subscription migration for version 0.2.0.
 */
class version_0_2_0 extends migration
{
    /**
     * @inheritDoc
     */
    static public function depends_on()
    {
        return array('\stevotvr\groupsub\migrations\version_0_1_0');
    }

    /**
     * @inheritDoc
     */
    public function update_schema()
    {
        return array(
            'add_columns' => array(
                $this->table_prefix . 'groupsub_groups' => array(
                    'group_default'    => array('BOOL', 0),
                ),
            ),
        );
    }

    /**
     * @inheritDoc
     */
    public function revert_schema()
    {
        return array(
            'drop_columns' => array(
                $this->table_prefix . 'groupsub_groups' => array(
                    'group_default',
                ),
            ),
        );
    }

    /**
     * @inheritDoc
     */
    public function effectively_installed()
    {
        return $this->db_tools->sql_column_exists($this->table_prefix . 'groupsub_groups', 'group_default');
    }
}