Foren

Customize core DB Column Sizes

Maksym Bodnar, geändert vor 7 Jahren.

Customize core DB Column Sizes

New Member Beiträge: 7 Beitrittsdatum: 13.07.16 Neueste Beiträge
Hi, I need to extend Organization.name from VARCHAR (100) to VARCHAR(200).
I'm working on Liferay 7.0.2 GA3.
There is some mechanisms to override liferay-portal / portal-impl / src / META-INF / portal-model-hints.xml?
Or something that can help me?
thumbnail
Jorge Díaz, geändert vor 7 Jahren.

RE: Customize core DB Column Sizes

Liferay Master Beiträge: 753 Beitrittsdatum: 09.01.14 Neueste Beiträge
The only mechanism to extend default Liferay model is to add attributes using "custom fields" (also known as expando), see: https://dev.liferay.com/discover/portal/-/knowledge_base/7-0/custom-fields

Using "custom fields" you can add new attributes to Liferay entities, but you cannot modify existing ones.

Perhaps you can create a custom attribute in order to store organization names greater than 100 characters.

About direct modifying Liferay schema, it isn't a good idea, If you do that, you probably will have some trobles with future upgrades.
Maksym Bodnar, geändert vor 7 Jahren.

RE: Customize core DB Column Sizes

New Member Beiträge: 7 Beitrittsdatum: 13.07.16 Neueste Beiträge
Thank you
thumbnail
Andrew Jardine, geändert vor 6 Jahren.

RE: Customize core DB Column Sizes

Liferay Legend Beiträge: 2416 Beitrittsdatum: 22.12.10 Neueste Beiträge
Hi Jorge,

Is this still true now that the EXT plugins are supported again? I have a similar case where the size of the address* fields in the Contact table need to be bigger than 75 characters (I know, it seems crazy, but so are some of these addresses!)

.. what about using an UpgradeProcess to alter the table column size?
thumbnail
Jorge Díaz, geändert vor 6 Jahren.

RE: Customize core DB Column Sizes (Antwort)

Liferay Master Beiträge: 753 Beitrittsdatum: 09.01.14 Neueste Beiträge
Hi Andrew,
About your message:
Andrew Jardine:
Is this still true now that the EXT plugins are supported again?
Changing core DB Column Sizes is nothing about how you change it (ext or other mechanisms) , it is about you should never change any Liferay database structure because:
  • You won't able to upgrade to new Liferay versions: you will have errors during upgrade process
  • You can have unexpected bugs in Liferay functionalities: if you increase the size in database but there is some Liferay code that considers column is 75 characters, you will have troubles

Andrew Jardine:
I have a similar case where the size of the address* fields in the Contact table need to be bigger than 75 characters (I know, it seems crazy, but so are some of these addresses!)
75 characters is the default size of Strings in Service Builder. If you think there is a field that it is too small, open a LPS ticket in https://issues.liferay.com or open a LESA ticket in case of having official support, explaining your case of use in order to consider that size change.
thumbnail
Andrew Jardine, geändert vor 6 Jahren.

RE: Customize core DB Column Sizes

Liferay Legend Beiträge: 2416 Beitrittsdatum: 22.12.10 Neueste Beiträge
Hi Jorge,

I was wondering g about an ext or an upgrade because you could apply them after and patches or upgrades to modify the columns after the fact. But you made an excellent point about the validation logic limiting it to 75. I mean, ultimately how ridiculous that there are addresses that long!

Thanks for the reply. I think a check that it doesn't exceed 150.. and if it doesn't then split it between address 1 and address 2. If it does, put everything over 150 in a.custom field as you suggested.

Thanks for getting back to me.
thumbnail
Jack Bakker, geändert vor 6 Jahren.

RE: Customize core DB Column Sizes

Liferay Master Beiträge: 978 Beitrittsdatum: 03.01.10 Neueste Beiträge
https://en.wikipedia.org/wiki/List_of_long_place_names

"Taumatawhakatangi­hangakoauauotamatea­turipukakapikimaunga­horonukupokaiwhen­uakitanatahu" (85 letters) which means "The summit where Tamatea, the man with the big knees, the climber of mountains, the land-swallower who travelled about, played his nose flute to his loved one"

nose flute ?
thumbnail
David H Nebinger, geändert vor 6 Jahren.

RE: Customize core DB Column Sizes

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
Most of our issues with column sizes stem from index limitations in some databases. If a column is unicode (which all are, btw) and also indexed, there's like a 200-or so char limit (I forget the exact number) in certain databases. Liferay is, in general, database agnostic, but at the same time we stay within the least supported bounds of each DB in order to maintain that neutrality. So while MySQL (or others) might not have this kind of hard limit, we won't exceed that because the same code would fail on another database.







Come meet me at Devcon 2017 or 2017 LSNA!
thumbnail
Andrew Jardine, geändert vor 6 Jahren.

RE: Customize core DB Column Sizes

Liferay Legend Beiträge: 2416 Beitrittsdatum: 22.12.10 Neueste Beiträge
Ah -- I see. Geez, that is good to know (and consider) when using service builder for your own plugin projects as well I guess. I;ve never come across this problem (yet) but I'll e sure to put that one in storage in case I ever do! Thanks, David.