Fórum

Migrate large amount of Web Contents from one site to global using DB Table

Alessandro Mattioli, modificado 9 Anos atrás.

Migrate large amount of Web Contents from one site to global using DB Table

New Member Postagens: 4 Data de Entrada: 25/07/14 Postagens Recentes
HI

I have to migrate a large amount of Web Contents from a site to the global scope.
I tried exporting a LAR from the site, but the import on the Global Site fails, so I thought to make this change directly in the db, but I can't find where the relationship between journal articles and scope is stored. Does someone have an idea of where the scope is saved in the DB for each web content?

Thanks
thumbnail
Victor Zorin, modificado 9 Anos atrás.

RE: Migrate large amount of Web Contents from one site to global using DB T

Liferay Legend Postagens: 1228 Data de Entrada: 14/04/08 Postagens Recentes
Have a look at groupId in journalarticle table. This is the id of a group where article was created in.

Create one test article in your source group, and then switch its' groupId to id of a target group using SQL update. The group definitions are stored in group_ table.
After running SQL update do not forget to restart the Liferay, as the values could be cached.

See if it works. If articles contain images and/or based on templates, you may have to play with those elements as well.
thumbnail
Vitaliy Koshelenko, modificado 9 Anos atrás.

RE: Migrate large amount of Web Contents from one site to global using DB T

Expert Postagens: 319 Data de Entrada: 25/03/11 Postagens Recentes
Hi,

You can also do it programatically, if don't want to update DB directly:

List<journalarticle> journalArticles = JournalArticleLocalServiceUtil.getArticles(groupId);
        for (JournalArticle journalArticle : journalArticles) {
            journalArticle.setGroupId(globalGroupId);
            JournalArticleLocalServiceUtil.updateArticle(journalArticle);
        }</journalarticle>


Vitaliy
thumbnail
Samuel Kong, modificado 9 Anos atrás.

RE: Migrate large amount of Web Contents from one site to global using DB T

Liferay Legend Postagens: 1902 Data de Entrada: 10/03/08 Postagens Recentes
Hi Alessandro,

You should not change the database tables directly. In addition to the JournalArticle table, there are other tables that will also need to update (e.g., asset). So unless you're super careful about also updating all the dependencies, you should do as Vitaliy suggested and do this using the API.
thumbnail
Vitaliy Koshelenko, modificado 9 Anos atrás.

RE: Migrate large amount of Web Contents from one site to global using DB T

Expert Postagens: 319 Data de Entrada: 25/03/11 Postagens Recentes
Also using Liferay API will update all the search indexes, so you will not need to restart Liferay/clean database cache/reindex search indexes, etc.