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

Version Path
decidim-core-0.27.3 db/migrate/20181030090144_destroy_deleted_users_follows.rb
decidim-core-0.27.2 db/migrate/20181030090144_destroy_deleted_users_follows.rb
decidim-core-0.27.1 db/migrate/20181030090144_destroy_deleted_users_follows.rb
decidim-core-0.27.0 db/migrate/20181030090144_destroy_deleted_users_follows.rb
decidim-core-0.27.0.rc2 db/migrate/20181030090144_destroy_deleted_users_follows.rb
decidim-core-0.27.0.rc1 db/migrate/20181030090144_destroy_deleted_users_follows.rb