|
- <?php
-
-
- use yii\db\Migration;
- use yii\db\Schema;
-
-
- class m240619_195454_create_table_accessory extends Migration
- {
-
-
- 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');
- }
-
-
-
- public function safeDown()
- {
- $this->dropTable('accessory');
- $this->dropForeignKey('fk_accessory_id_producer', 'accessory');
- }
- }
|