From f52930578ae62853d09f9dc34a384fe0da05a51b Mon Sep 17 00:00:00 2001 From: "Charles R. Portwood II" Date: Mon, 31 Jul 2017 12:39:58 -0500 Subject: [PATCH] MySQL migration fix for #175 --- protected/migrations/m141001_145619_init.php | 2 +- ..._173719_comments_and_relationships_fix.php | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 protected/migrations/m170731_173719_comments_and_relationships_fix.php diff --git a/protected/migrations/m141001_145619_init.php b/protected/migrations/m141001_145619_init.php index 2cbfd48e..f2d4eec0 100644 --- a/protected/migrations/m141001_145619_init.php +++ b/protected/migrations/m141001_145619_init.php @@ -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( diff --git a/protected/migrations/m170731_173719_comments_and_relationships_fix.php b/protected/migrations/m170731_173719_comments_and_relationships_fix.php new file mode 100644 index 00000000..d29bfbea --- /dev/null +++ b/protected/migrations/m170731_173719_comments_and_relationships_fix.php @@ -0,0 +1,25 @@ +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() + { + } + */ +} \ No newline at end of file