ActiveRecord::Base.connection.tables.each do |t|
next if t == base.table_name
next if t == 'schema_migrations'
+ next if t == 'permission_refresh_lock'
+ next if t == 'ar_internal_metadata'
+ next if t == 'commit_ancestors'
+ next if t == 'commits'
klass = t.classify.constantize
next unless klass and 'owner_uuid'.in?(klass.columns.collect(&:name))
base.has_many(t.to_sym,