留言板

Liferay Default Column size

thumbnail
Mathieu Hicauber,修改在11 年前。

Liferay Default Column size

Junior Member 帖子: 79 加入日期: 10-12-22 最近的帖子
Hi,

I know there's a wiki topic covering the subject (http://www.liferay.com/community/wiki/-/wiki/Main/Customize+DB+Column+Sizes) , but I'm stucked with this : how to change the column size of an existing liferay table ?

I'd like to increase the length of the articleId column of the journalContent portlet from 75 to, let's say, 200.

So I created an ext-model-hints.xml file in my ext plugin with my custom max-length attribute for the model, and redeployed my plugin. That doesn't do the trick.

I saw on multiple thread people talking aout re-generating services with the build-services ant task. Does it implie to copy the journal model in a service.xml file in the ext plugin ? I don't get it....

Thank you,

Mathieu.
thumbnail
Mika Koivisto,修改在11 年前。

RE: Liferay Default Column size

Liferay Legend 帖子: 1519 加入日期: 06-8-7 最近的帖子
If you want to change a existing table column length you need to edit portal-model-hints.xml and regenerate services. All this needs to be done from the portal source doing it from ext won't help. If you already have the database created with old column size you need to add a upgrade script or change it directly to the database. In any case you shouldn't mess with the portal core.
thumbnail
Mathieu Hicauber,修改在11 年前。

RE: Liferay Default Column size

Junior Member 帖子: 79 加入日期: 10-12-22 最近的帖子
Hi,

Thank you for your answer.

Mika Koivisto:
In any case you shouldn't mess with the portal core.


Do you mean I shouldn't do that ?

Mika Koivisto:
you need to add a upgrade script or change it directly to the database


I changed it in the database, but still have a "Data too long for column..." data truncation error when the servie tries to add the article in the DB.
thumbnail
Harish Kumar,修改在11 年前。

RE: Liferay Default Column size

Expert 帖子: 483 加入日期: 10-7-31 最近的帖子
Hi Mathieu,

Changing the column size directly in DB won't work as Liferay implementation classes have checks to truncate data that goes beyond specified default length.

you have to go through the ext plugin way. Make sure you making changes to ext-impl/src/META-INF/ext-model-hints.xml

HTH
thumbnail
Mathieu Hicauber,修改在11 年前。

RE: Liferay Default Column size

Junior Member 帖子: 79 加入日期: 10-12-22 最近的帖子
Hi Harish,

Thank you for your answer.
I already made changes in the ext-model-hints.xml file. I just don't get how to regenerate the validation layer.

Mathieu.
thumbnail
Harish Kumar,修改在11 年前。

RE: Liferay Default Column size

Expert 帖子: 483 加入日期: 10-7-31 最近的帖子
Please check this thread. I think there is a way to persist the changes to ext-model-hints.xml file.
thumbnail
Mathieu Hicauber,修改在11 年前。

RE: Liferay Default Column size

Junior Member 帖子: 79 加入日期: 10-12-22 最近的帖子
I'll check that thank you.