Commit 08b5c1c455ff72c0ca96d56296859c07372cdd00
1 parent
b5639b59
comments in admin
Showing
1 changed file
with
37 additions
and
0 deletions
Show diff stats
migrations/m170831_094035_comment_add_foreogn_key.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\db\Migration; | ||
| 4 | + | ||
| 5 | +class m170831_094035_comment_add_foreogn_key extends Migration | ||
| 6 | +{ | ||
| 7 | + public function safeUp() | ||
| 8 | + { | ||
| 9 | + $this->addForeignKey('comment_customer', | ||
| 10 | + 'artbox_comment', | ||
| 11 | + 'customer_id', | ||
| 12 | + 'customer', | ||
| 13 | + 'id', | ||
| 14 | + 'CASCADE', | ||
| 15 | + 'CASCADE'); | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + public function safeDown() | ||
| 19 | + { | ||
| 20 | + $this->dropForeignKey('comment_customer', 'artbox_comment'); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + /* | ||
| 24 | + // Use up()/down() to run migration code without a transaction. | ||
| 25 | + public function up() | ||
| 26 | + { | ||
| 27 | + | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public function down() | ||
| 31 | + { | ||
| 32 | + echo "m170831_094035_comment_add_foreogn_key cannot be reverted.\n"; | ||
| 33 | + | ||
| 34 | + return false; | ||
| 35 | + } | ||
| 36 | + */ | ||
| 37 | +} |