xoops forums

shivaji

Friend of XOOPS
Posted on: 2003/11/3 6:46
shivaji
shivaji (Show more)
Friend of XOOPS
Posts: 179
Since: 2003/9/18
#1

Want to change table structure of existing table using sql.

I want to change the table structure of "users" table (want to add a column ) using a sql file (located at sql directory in my mudule directory) during installation of my module. When I try to install my module it's showing some errors that "users table is preserved" and it stop to install my module, but whenever I move the sql query ( which add an column in "users" table) then it's working perfectly, create tables as per my requierments.

Can anybody tell me how can I aviod this restriction.


onokazu

XOOPS Founder
Posted on: 2003/11/3 9:56
onokazu
onokazu (Show more)
XOOPS Founder
Posts: 617
Since: 2001/12/13
#2

Re: Want to change table structure of existing table using sql.

The core tables are protected so that they are not changed by the modules. Your XOOPS may lose compatiblility with the future versions of XOOPS. There is a way to change the tables during install, using php though. Can you tell me why you need to change the table?

shivaji

Friend of XOOPS
Posted on: 2003/11/3 12:57
shivaji
shivaji (Show more)
Friend of XOOPS
Posts: 179
Since: 2003/9/18
#3

Re: Want to change table structure of existing table using sql.

ya it will not work during installation of a new module but if I change the "install\sql\mysql.structure.sql" then
it will work as per my requiermant. Actually I want to add an extra filed in "users" table which will store some information against each user.

Mithrandir

XOOPS is my life!
Posted on: 2003/11/3 16:34
Mithrandir
Mithrandir (Show more)
XOOPS is my life!
Posts: 6320
Since: 2003/6/21
#4

Re: Want to change table structure of existing table using sql.

A way to work around this would be to make another table named e.g. [Prefix_MyModule_]users and have a one:one relationship with the [prefix]users table.

On install just take all the uid's from the [prefix]users table and insert into the [Prefix_MyModule_]users table.

Of course this would mean that new registrations will not update the [Prefix_MyModule]users table, but I guess you have some procedure for adding information in that field, so just check to see if the uid is already in the database - if yes, then update, else insert.

spajot

Just popping in
Posted on: 2003/11/10 14:00
spajot
spajot (Show more)
Just popping in
Posts: 2
Since: 2003/11/10
#5

Re: Want to change table structure of existing table using sql.

Okay, but then, how can man centralize the update of this extra data through the "edit profile" page ?
Is hacking into html\modules\system\admin\users\userform.php the only way to achieve this ?

Sylvain

Mithrandir

XOOPS is my life!
Posted on: 2003/11/10 15:10
Mithrandir
Mithrandir (Show more)
XOOPS is my life!
Posts: 6320
Since: 2003/6/21
#6

Re: Want to change table structure of existing table using sql.

Can't see any other way, to be frank - unless you make your own "Edit Extended Profile" page.