<?php

use yii\db\Migration;
use yii\db\Schema;

/**
 * Class m220209_095208_product_availability_point_sale
 */
class m220209_095208_product_availability_point_sale extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->addColumn('product', 'available_on_points_sale', Schema::TYPE_BOOLEAN.' DEFAULT 1');
        $this->createTable('product_point_sale', [
                'id' => 'pk',
                'id_product' => Schema::TYPE_INTEGER. ' NOT NULL',
                'id_point_sale' => Schema::TYPE_INTEGER. ' NOT NULL',
                'available' => Schema::TYPE_BOOLEAN.' DEFAULT 1',
        ]);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropColumn('product', 'available_on_points_sale');
        $this->dropTable('product_point_sale');
    }
}
