Sha256: 4db8db541e81ddb15885e1694cf84f8a6ff829a6ecc4dc06d7e9c4ff7c95d3ed
Contents?: true
Size: 530 Bytes
Versions: 6
Compression:
Stored size: 530 Bytes
Contents
# frozen_string_literal: true class DestroyDeletedUsersFollows < ActiveRecord::Migration[5.2] class Follow < ApplicationRecord self.table_name = "decidim_follows" end class User < ApplicationRecord self.table_name = "decidim_users" end def change deleted_users = Decidim::User.where.not(deleted_at: nil).pluck(:id) Follow.where(decidim_followable_type: "Decidim::UserBaseEntity", decidim_followable_id: deleted_users).destroy_all Follow.where(decidim_user_id: deleted_users).destroy_all end end
Version data entries
6 entries across 6 versions & 1 rubygems