Foren

Liferay Default Column size

thumbnail
Mathieu Hicauber, geändert vor 11 Jahren.

Liferay Default Column size

Junior Member Beiträge: 79 Beitrittsdatum: 22.12.10 Neueste Beiträge
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, geändert vor 11 Jahren.

RE: Liferay Default Column size

Liferay Legend Beiträge: 1519 Beitrittsdatum: 07.08.06 Neueste Beiträge
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, geändert vor 11 Jahren.

RE: Liferay Default Column size

Junior Member Beiträge: 79 Beitrittsdatum: 22.12.10 Neueste Beiträge
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, geändert vor 11 Jahren.

RE: Liferay Default Column size

Expert Beiträge: 483 Beitrittsdatum: 31.07.10 Neueste Beiträge
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, geändert vor 11 Jahren.

RE: Liferay Default Column size

Junior Member Beiträge: 79 Beitrittsdatum: 22.12.10 Neueste Beiträge
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, geändert vor 11 Jahren.

RE: Liferay Default Column size

Expert Beiträge: 483 Beitrittsdatum: 31.07.10 Neueste Beiträge
Please check this thread. I think there is a way to persist the changes to ext-model-hints.xml file.
thumbnail
Mathieu Hicauber, geändert vor 11 Jahren.

RE: Liferay Default Column size

Junior Member Beiträge: 79 Beitrittsdatum: 22.12.10 Neueste Beiträge
I'll check that thank you.