-
Notifications
You must be signed in to change notification settings - Fork 0
DB Migrations
To migrate the comments from v1 to v2 (mysql to mongodb) run the following command
./artisan comment:migration
from the laravel directory. Note that if a post no longer exists in the new system, the comments related to that post will not be migrated. If the author of a comment no longer exists, the comment will still be migrated with author 'nobody'.
This command updates the slugs so that we can order by both desc/asc order.
./artisan comment:sorting
If you have already indexed mongo you may need to remove the previous un-used indexes. To check which fields are currently indexed, run this command in mongo cli.
db.comments.getIndexes()
If you need to drop the previously indexed (post_id, full_slug)... Note: 'post_id_1_full_slug_1' is the 'name' attribute found in the getIndexes() command.
db.comments.dropIndex('post_id_1_full_slug_1')
To add the new indexes for asc and desc slugs run the following commands
db.comments.ensureIndex({'post_id': 1, 'full_slug_asc': 1})
db.comments.ensureIndex({'post_id': 1, 'full_slug_desc': 1})