留言板

Customizing Liferay Database Tables

Sakshi Saxena,修改在9 年前。

Customizing Liferay Database Tables

New Member 帖子: 2 加入日期: 15-2-18 最近的帖子
Hello Everyone...
I want to remove some columns from table "User_" of Liferay Database (Lportal) as I don't want to store user's last login IP address...
How can I do that??
thumbnail
David H Nebinger,修改在9 年前。

RE: Customizing Liferay Database Tables (答复)

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Sakshi Saxena:
I want to remove some columns from table "User_" of Liferay Database (Lportal) as I don't want to store user's last login IP address... How can I do that??


never ever ever do this. You shouldn't even be looking in the database. You should just forget that it's there and what all of the tables and columns are. Seriously, if you monkey with the database you risk severely breaking your system. for example, to drop this column you'd have to modify all of the Liferay entities, all of the Hibernate mappings, all of the code in Liferay that use this column, ... Seriously, do not do this. Close your database browsing tool now and delete it from your system and never go back to the database again.

If I haven't already emphasized this enough, let me bolden it: DO NOT EVER DO ANYTHING AT ALL IN THE LIFERAY DATABASE! IT IS NOT YOURS, DO NOT LOOK AT IT AGAIN!

Any possible addition, change, tweak, whatever you do can break your system, and in some cases the breakages might not be recoverable.

Now if you had instead asked "How can I avoid populating the user's last login IP addresses?" then my response would be quite different. Create a ModelListener for the User entity and, in the onBeforeCreate and onBeforeUpdate methods just blank out the field. This is gets invoked right before the database is updated. You can't remove the column, but you can certainly block populating it.
thumbnail
mohammad azaruddin,修改在9 年前。

RE: Customizing Liferay Database Tables

Expert 帖子: 492 加入日期: 12-9-17 最近的帖子
David H Nebinger:

DO NOT EVER DO ANYTHING AT ALL IN THE LIFERAY DATABASE! IT IS NOT YOURS, DO NOT LOOK AT IT AGAIN!



lol emoticonemoticonemoticon
Sakshi Saxena,修改在9 年前。

RE: Customizing Liferay Database Tables

New Member 帖子: 2 加入日期: 15-2-18 最近的帖子
Thank You David..
Avoiding entry of user's last login IP addresses would work for me....