Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: 6.2 to DXP 7.1 Upgrade-How to migrate comments
Gopal Prasad Satapathy, modified 6 Years ago.
Junior Member
Posts: 51
Join Date: 3/29/18
Recent Posts
Hello,Currently upgrading from 6.2 to DXP 7.1 . Created dump of production database and doc library and the same is being used for the upgrade.
Being an evolving production system, we expect new (delta)comments being added to the web contents which are part of a asset publisher, after creation of the dump.Any pointer on how separately these comments alone can be migrated ?
Thanks in advance.Gopal
Being an evolving production system, we expect new (delta)comments being added to the web contents which are part of a asset publisher, after creation of the dump.Any pointer on how separately these comments alone can be migrated ?
Thanks in advance.Gopal
Uh, that's a hard one. We have struggled with the general issue of upgrading and replacing the current system too. Users might register, content might be added, documents, ... all while we are working on the upgrade of the system.
I am afraid, there is no out of the box solution here. If your problem is limited to comments (it usually isn't) than you might get away with:
a) Write an export service that exports all comments (maybe after a specific date or something like that to get only the delta)
b) Write an import service that adds the missing comments
In my experience, the edit problem will affect more than just comments. Usually we do follow these steps:
1) Prepare the upgrade
Upgrade the database on a test system
Migrate the code, templates, configuration, ... on that dump
Write an upgrade guide (Change setting x, change ...)
We also often script some tasks
Please don't forget the you can export system settings an put them into the filesystem (This helps alot!)
2) Do a test upgrade
Basically, we do everything here what we would do during a real upgrade. If a major problem appears, we might even repeat this step. Usually some issues are found here, steps that were not documented, ...
3) Do the upgrade
On some date, often a weekend, we make the current production system readonly (e.g. by disabling the login). Sometimes we just add a big banner "Please do not edit, your edits will be lost ..." or even shut the system down and show some "Men at work" message. What we do, depends on the customer.
Then we upgrade a clone of the production system, deploy, apply the changes, run the scripts, do some tests and switch to the new server.
I am afraid, there is no out of the box solution here. If your problem is limited to comments (it usually isn't) than you might get away with:
a) Write an export service that exports all comments (maybe after a specific date or something like that to get only the delta)
b) Write an import service that adds the missing comments
In my experience, the edit problem will affect more than just comments. Usually we do follow these steps:
1) Prepare the upgrade
Upgrade the database on a test system
Migrate the code, templates, configuration, ... on that dump
Write an upgrade guide (Change setting x, change ...)
We also often script some tasks
Please don't forget the you can export system settings an put them into the filesystem (This helps alot!)
2) Do a test upgrade
Basically, we do everything here what we would do during a real upgrade. If a major problem appears, we might even repeat this step. Usually some issues are found here, steps that were not documented, ...
3) Do the upgrade
On some date, often a weekend, we make the current production system readonly (e.g. by disabling the login). Sometimes we just add a big banner "Please do not edit, your edits will be lost ..." or even shut the system down and show some "Men at work" message. What we do, depends on the customer.
Then we upgrade a clone of the production system, deploy, apply the changes, run the scripts, do some tests and switch to the new server.
Gopal Prasad Satapathy, modified 6 Years ago.
Junior Member
Posts: 51
Join Date: 3/29/18
Recent Posts
Hello Christoph ,Thanks for your feedback.Indeed, edit problem will affect more than just comments. But somehow we have managed to limit that problem.
So only problem is with the comments now.As you have suggested to write a custom export and import service for the comments, could you kindly elaborate on how to write the services. Or can point to any existing example that can be followed?
ThanksGopal
So only problem is with the comments now.As you have suggested to write a custom export and import service for the comments, could you kindly elaborate on how to write the services. Or can point to any existing example that can be followed?
ThanksGopal
I am not sure if there is an example somewhere. I believe that comments are stored as MBMessage entries.
I would create a rest service (rest module in blade/IDE) and add an export method:
@Reference
MBMessageLocalService messageLocalService;
@GET
public void export() {
// I am not sure what the parameters here are, you probably need to experiment a bit with the messageLocalService methods to get a good list
List<MBMessage> messages = messageLocalService.getMessages(...);
// Iterate messages and write them e.g. as json to a file
// Drop messages that are already imported by some rule (e.g. date)
// return filtered messages as rest result
}
With this, you should get the list of entries. You could also write it to a file or create a portlet instead that writes it to a file, if you have no experience with rest services.
When importing, you need to read the export and add the missing entries. If there are no new users, you should be able to simply use the old userId to create the new discussion entries.
I would create a rest service (rest module in blade/IDE) and add an export method:
@Reference
MBMessageLocalService messageLocalService;
@GET
public void export() {
// I am not sure what the parameters here are, you probably need to experiment a bit with the messageLocalService methods to get a good list
List<MBMessage> messages = messageLocalService.getMessages(...);
// Iterate messages and write them e.g. as json to a file
// Drop messages that are already imported by some rule (e.g. date)
// return filtered messages as rest result
}
With this, you should get the list of entries. You could also write it to a file or create a portlet instead that writes it to a file, if you have no experience with rest services.
When importing, you need to read the export and add the missing entries. If there are no new users, you should be able to simply use the old userId to create the new discussion entries.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™