You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
as indicated in the readme, immigrant might detect "missing" keys if you use multiple databases or schemas. those "missing" keys are actually:
keys that already exist (e.g. between two tables in a different db),
keys that cannot exist (from one database to another), or
keys that should probably not exist (from one schema to another, e.g. if you're using the apartment gem ... while they could be created, it all falls apart once you move beyond a single db ... see point 2.)
immigrant should:
ask each model's connection for its foreign keys, rather than ActiveRecord::Base.connection ... this partially addresses the first problem
ignore associations across databases
for tables within the same database, ignore associations across schemas (for apartment+postgres at least, we can tell this from the table_name's prefix ... "public." vs. ""). might need to do a little research to make sure this is done in a sharding-agnostic way (if possible)
The text was updated successfully, but these errors were encountered:
Immigrant.ignore_keys allows you to specify a list of keys that should be
ignored (both in the migration generator and the rake task). this is
useful if you have associations spanning schemas or databases (see #21)
just create an config/initializers/immigrant.rb file with something like
the following:
Immigrant.ignore_keys = [
{ from_table: "users", column: "account_id" },
# etc
]
note that you need to specify both the from_table and the column
as indicated in the readme, immigrant might detect "missing" keys if you use multiple databases or schemas. those "missing" keys are actually:
immigrant should:
The text was updated successfully, but these errors were encountered: