Skip to content

Instantly share code, notes, and snippets.

@stuartbates
Created August 13, 2013 08:40
Show Gist options
  • Save stuartbates/6219110 to your computer and use it in GitHub Desktop.
Save stuartbates/6219110 to your computer and use it in GitHub Desktop.
<?php
class m130726_082858_yii_category_point extends CDbMigration
{
public function up()
{
$this->createTable('yii_category_point', array(
'category_id'=>'int NOT NULL',
'point_id'=>'int NOT NULL',
'PRIMARY KEY (`category_id`, `point_id`)'
));
$this->addForeignKey('fk_category_point_point_id', 'yii_category_point', 'category_id', 'yii_category', 'id' );
$this->addForeignKey('fk_category_point_category_id', 'yii_category_point', 'point_id', 'yii_point', 'id' );
}
public function down()
{
$this->dropTable('yii_category_point');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment