Fix GH #4259. When we execute schema dumper, we must remove table_name_prefix and table_name_suffix. #4396

Merged
merged 1 commit into from Jun 20, 2012

Projects

None yet

4 participants

@ankitenggcom

Thanks Kenny.

Done with updating the file.

@kennyj
Contributor
kennyj commented Jan 10, 2012

Oops.. This commit has one problem.
We must consider not only ActiveRecord::Base.table_name_prefix/suffix but also a model's own prefix/suffix !
It's a little hard ;-)

@kennyj
Contributor
kennyj commented Jan 10, 2012

This PR is closing, because this one has a problem.
I'll be back...

@kennyj kennyj closed this Jan 10, 2012
@dlitz
dlitz commented Apr 11, 2012

I don't think it's possible (or desirable) to fix the case where a model has its own table_name_prefix and table_name_suffix, and even if it is, I think this patch should be committed as-is until someone figures out how to do this.

The reason is that the models aren't even loaded when when database schema is dumped or loaded, so reading individual model classes' table_name_(pre|suf)fix attributes is a non-starter. Also, having a different prefix on each model is likely the kind of thing that someone will do when they're interfacing with an external database from another application. In that case, it's unlikely that the user wants those tables to be created anyway.

@kennyj kennyj reopened this Apr 12, 2012
@kennyj
Contributor
kennyj commented Apr 12, 2012

Hi ! Rails core team.
I reopend this PR, because I think this PR isn't completely, but this is useful for many people.

Please review it.

@rafaelfranca
Member
@rafaelfranca
Member

@kennyj could you look if this will fix #6617?

@kennyj
Contributor
kennyj commented Jun 20, 2012

@rafaelfranca I think that is another problem, but similar.

about #6617
Basically, we don't load some models when executing migration. thus rails don't know User.table_name's value.

@rafaelfranca
Member

@kennyj ok. Thank you. I'll merge this one.

@rafaelfranca rafaelfranca merged commit 211dcde into rails:master Jun 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment