diff --git a/LikePlugin.php b/LikePlugin.php index cfd5fcf..ada40b4 100755 --- a/LikePlugin.php +++ b/LikePlugin.php @@ -33,20 +33,6 @@ public function init() } } }); - - craft()->on('users.onBeforeDeleteUser', function(Event $event) { - - if (!craft()->config->get('retainLikesOnUserDeletion', 'like')) - { - $user = $event->params['user']; - $likes = craft()->like->getLikesByUserId($user->id); - - foreach($likes as $like) - { - craft()->like->deleteLikeById($like->id); - } - } - }); } /** @@ -70,7 +56,7 @@ function getVersion() */ public function getSchemaVersion() { - return '0.9.8'; + return '1.0.0'; } /** diff --git a/config.php b/config.php deleted file mode 100644 index 8cdfe2b..0000000 --- a/config.php +++ /dev/null @@ -1,5 +0,0 @@ - false, -); diff --git a/migrations/m160501_000001_like_make_userId_column_not_required.php b/migrations/m160501_000001_like_make_userId_column_not_required.php deleted file mode 100644 index e0df792..0000000 --- a/migrations/m160501_000001_like_make_userId_column_not_required.php +++ /dev/null @@ -1,23 +0,0 @@ -db->createCommand()->dropForeignKey('likes', 'userId'); - craft()->db->createCommand()->alterColumn('likes', 'userId', array(ColumnType::Int, 'null' => true)); - craft()->db->createCommand()->addForeignKey('likes', 'userId', 'users', 'id', 'SET NULL', null); - - return true; - } -} diff --git a/records/LikeRecord.php b/records/LikeRecord.php index 3defcd4..1f68a77 100755 --- a/records/LikeRecord.php +++ b/records/LikeRecord.php @@ -43,7 +43,7 @@ public function defineIndexes() public function defineRelations() { return array( - 'user' => array(static::BELONGS_TO, 'UserRecord', 'userId', 'required' => false), + 'user' => array(static::BELONGS_TO, 'UserRecord', 'userId', 'required' => true), 'element' => array(static::BELONGS_TO, 'ElementRecord', 'elementId', 'required' => true) ); }