|
- <?php
-
- use yii\db\Migration;
- use yii\db\Schema;
-
- /**
- * Class m231110_084013_create_tables_feature_flag
- */
- class m231110_084013_create_tables_feature_flag extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $this->createTable('feature', [
- 'id' => 'pk',
- 'alias' => Schema::TYPE_STRING.' NOT NULL',
- 'name' => Schema::TYPE_STRING.' NOT NULL',
- 'description' => Schema::TYPE_TEXT,
- 'is_paid_feature' => Schema::TYPE_BOOLEAN,
- 'price' => Schema::TYPE_FLOAT,
- 'only_for_selected_producers' => Schema::TYPE_BOOLEAN,
- 'status' => Schema::TYPE_BOOLEAN.' DEFAULT 1',
- ]);
-
- $this->createTable('feature_producer', [
- 'id' => 'pk',
- 'id_producer' => Schema::TYPE_INTEGER.' NOT NULL',
- 'id_feature' => Schema::TYPE_INTEGER.' NOT NULL',
- 'status' => Schema::TYPE_BOOLEAN.' DEFAULT 1',
- ]);
-
- $this->addForeignKey('producer_fk', 'feature_producer', 'id_producer', 'producer', 'id');
- $this->addForeignKey('feature_fk', 'feature_producer', 'id_feature', 'feature', 'id');
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('feature');
- $this->dropTable('feature_producer');
- }
- }
|