createTable ( '{{%payment}}', [ 'payment_id' => $this->primaryKey (), 'name' => $this->string (255) ->notNull (), 'status' => $this->integer () ->defaultValue (1), ], null ); $this->batchInsert ('{{%payment}}', ['name'], [['Наличный расчет'], ['Безналичный расчет'], ['Электронные деньги']]); $this->createTable ( '{{%user_payment}}', [ 'user_payment_id' => $this->primaryKey (), 'user_id' => $this->integer (), 'payment_id' => $this->integer (), ] ); $this->createTable ( '{{%user_specialization}}', [ 'user_specialization_id' => $this->primaryKey (), 'user_id' => $this->integer (), 'specialization_id' => $this->integer (), ] ); $this->addForeignKey ('user_speialization_specialization', '{{%user_specialization}}', 'specialization_id', '{{%specialization}}', 'specialization_id', 'CASCADE', 'CASCADE'); $this->addForeignKey ('user_payment_payment', '{{%user_payment}}', 'payment_id', '{{%payment}}', 'payment_id', 'CASCADE', 'CASCADE'); } public function down () { $this->dropTable ('{{%payment}}'); $this->dropTable('{{%user_specialization}}'); $this->dropTable('{{%user_payment}}'); } /* // Use safeUp/safeDown to run migration code within a transaction public function safeUp() { } public function safeDown() { } */ }