Skip to content
This repository has been archived by the owner on Sep 25, 2018. It is now read-only.

Commit

Permalink
MySQL migration fix for #175
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesportwoodii committed Jul 31, 2017
1 parent 8456922 commit f529305
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion protected/migrations/m141001_145619_init.php
Expand Up @@ -83,7 +83,7 @@ private function createUserTables()
$this->addPrimaryKey('user_metadata_composite', 'user_metadata', 'user_id,key');

// Setup the foreign key constraints
$this->addForeignKey('user_roles_relation_fk', 'user_metadata', 'user_id', 'users', 'id', 'CASCADE', 'NO ACTION');
$this->addForeignKey('user_metadata_relation_fk', 'user_metadata', 'user_id', 'users', 'id', 'CASCADE', 'NO ACTION');

// Insert data into the tables
$this->insert('user_roles', array(
Expand Down
@@ -0,0 +1,25 @@
<?php

class m170731_173719_comments_and_relationships_fix extends CDbMigration
{
public function up()
{
}

public function down()
{
$this->addForeignKey('user_roles_fk', 'users', 'user_role', 'user_roles', 'id', 'CASCADE', 'NO ACTION');
$this->execute('ALTER TABLE `comments` MODIFY comment TEXT NOT NULL');
}

/*
// Use safeUp/safeDown to do migration with transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

0 comments on commit f529305

Please sign in to comment.