Please see #4259
Fix GH #4259. We must remove table_name_prefix and table_name_suffix,…
… when we execute schema dumper.
Done with updating the file.
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 ;-)
This PR is closing, because this one has a problem.
I'll be back...
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.
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.
@kennyj could you look if this will fix #6617?
@rafaelfranca I think that is another problem, but similar.
Basically, we don't load some models when executing migration. thus rails don't know User.table_name's value.
@kennyj ok. Thank you. I'll merge this one.