Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Mathieu Hicauber
Liferay Default Column size
September 11, 2012 5:35 AM
Answer

Mathieu Hicauber

Rank: Junior Member

Posts: 79

Join Date: December 22, 2010

Recent Posts

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.
Mika Koivisto
RE: Liferay Default Column size
September 11, 2012 4:17 PM
Answer

Mika Koivisto

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1512

Join Date: August 7, 2006

Recent Posts

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.
Mathieu Hicauber
RE: Liferay Default Column size
September 12, 2012 12:15 AM
Answer

Mathieu Hicauber

Rank: Junior Member

Posts: 79

Join Date: December 22, 2010

Recent Posts

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.
Harish Kumar
RE: Liferay Default Column size
September 12, 2012 8:40 AM
Answer

Harish Kumar

Rank: Expert

Posts: 471

Join Date: July 31, 2010

Recent Posts

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
Mathieu Hicauber
RE: Liferay Default Column size
September 12, 2012 12:58 PM
Answer

Mathieu Hicauber

Rank: Junior Member

Posts: 79

Join Date: December 22, 2010

Recent Posts

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.
Harish Kumar
RE: Liferay Default Column size
September 12, 2012 9:49 PM
Answer

Harish Kumar

Rank: Expert

Posts: 471

Join Date: July 31, 2010

Recent Posts

Please check this thread. I think there is a way to persist the changes to ext-model-hints.xml file.
Mathieu Hicauber
RE: Liferay Default Column size
September 13, 2012 12:35 AM
Answer

Mathieu Hicauber

Rank: Junior Member

Posts: 79

Join Date: December 22, 2010

Recent Posts

I'll check that thank you.