4253cbec
root
first commit
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<?php
use yii\db\Migration;
class m160721_152001_create_product_to_rating extends Migration
{
public function up()
{
$this->createTable('product_to_rating', [
'product_to_rating_id' => $this->primaryKey(),
'product_id' => $this->integer()->notNull(),
'value' => $this->float()->defaultValue(0),
]);
$this->addForeignKey('product_to_rating_product', 'product_to_rating', 'product_id', 'product', 'product_id', 'CASCADE', 'CASCADE');
}
public function down()
{
$this->dropForeignKey('product_to_rating_product', 'product_to_rating');
$this->dropTable('product_to_rating');
}
}
|