Managing tables and tables columns within my rails app

Hi all,

I’m wondering if it is possible to manage tables and tables columns in
rails…
Might be not very clear so here is an example :

I have an application that has specific tables for the users of my app.
Let say, I create a database with a ‘users’ table template (first_name,
last_name, email, country).
When “joe” creates an account in my app , I want to creates a
“joo_users” table which is a “copy” of my template “users” table.
Now, joe doesn’t care of, let say, the country of his customers so he
decides to “remove” the “country” column of his “joe_users” table …

The same thing if “joe” wants to creates a new column in a specific
table …

What I would like to have is user be able to remove some table columns
so his “screen” won’t be polluated with fields that he doesn’t care of.

Is it possible ?
If so I can I do this ?

-> do some create table stuff using SQL command within rails and pass
to “table_prefix” “joe” (or whatever is my client name) my “user” model
-> do some ALTER table stuff using SQL command within rails to remove
unwanted table column ?

Thanks for all your answers !

Hey Julien

Did you find a way to do this? I have the exact same requirement.

Thanks
p3rlhax
Julien Delgoulet wrote:

Hi all,

I’m wondering if it is possible to manage tables and tables columns in
rails…
Might be not very clear so here is an example :

I have an application that has specific tables for the users of my app.
Let say, I create a database with a ‘users’ table template (first_name,
last_name, email, country).
When “joe” creates an account in my app , I want to creates a
“joo_users” table which is a “copy” of my template “users” table.
Now, joe doesn’t care of, let say, the country of his customers so he
decides to “remove” the “country” column of his “joe_users” table …

The same thing if “joe” wants to creates a new column in a specific
table …

What I would like to have is user be able to remove some table columns
so his “screen” won’t be polluated with fields that he doesn’t care of.

Is it possible ?
If so I can I do this ?

-> do some create table stuff using SQL command within rails and pass
to “table_prefix” “joe” (or whatever is my client name) my “user” model
-> do some ALTER table stuff using SQL command within rails to remove
unwanted table column ?

Thanks for all your answers !

On 5/22/07, p3rlhax [email protected] wrote:

Hey Julien

Did you find a way to do this? I have the exact same requirement.

Hey buddy,

you do not want to alter your db schema dynamically. It may be
possible, even using RoR/AR, but it’s never a good idea.

I suggest you pick up a good book or two on db modelling instead,
and/or post your problem on a database oriented forum.

Sincerely,
Isak