|
12345678910111213141516171819202122232425262728293031323334 |
- <?php
-
- use yii\db\Migration;
- use yii\db\Schema;
-
- /**
- * Class m240619_195454_create_table_accessory
- */
- class m240619_195454_create_table_accessory extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $this->createTable('accessory', [
- 'id' => 'pk',
- 'id_producer' => Schema::TYPE_INTEGER.' NOT NULl',
- 'name' => Schema::TYPE_STRING.' NOT NULl',
- 'quantity' => Schema::TYPE_INTEGER
- ]);
-
- $this->addForeignKey('fk_accessory_id_producer', 'accessory', 'id_producer', 'producer', 'id');
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('accessory');
- $this->dropForeignKey('fk_accessory_id_producer', 'accessory');
- }
- }
|