Folllow up for issue #1977 - recent_views fk already exists.
This commit is contained in:
parent
cf88f53095
commit
156abbbcf9
1 changed files with 1 additions and 4 deletions
|
@ -15,15 +15,12 @@ class Issue1977RemoveInvalidUserForeignKeys < ActiveRecord::Migration[5.1]
|
||||||
|
|
||||||
Avatar.joins('LEFT OUTER JOIN users ON avatars.o_id = users.id')
|
Avatar.joins('LEFT OUTER JOIN users ON avatars.o_id = users.id')
|
||||||
.where('users.id IS NULL')
|
.where('users.id IS NULL')
|
||||||
.where(
|
.where(object_lookup_id: ObjectLookup.by_name('User'))
|
||||||
object_lookup_id: ObjectLookup.by_name('User')
|
|
||||||
)
|
|
||||||
.destroy_all
|
.destroy_all
|
||||||
|
|
||||||
# add (possibly) missing foreign_key
|
# add (possibly) missing foreign_key
|
||||||
foreign_keys = [
|
foreign_keys = [
|
||||||
%i[online_notifications users],
|
%i[online_notifications users],
|
||||||
[:recent_views, :users, column: :created_by_id]
|
|
||||||
]
|
]
|
||||||
|
|
||||||
foreign_keys.each do |args|
|
foreign_keys.each do |args|
|
||||||
|
|
Loading…
Reference in a new issue