class RemoveSpecialistDocumentEditionsWithNonManualDocumentType < Mongoid::Migration
  def self.up
    SpecialistDocumentEdition.where(:document_type.ne => 'manual').delete_all
  end

  def self.down
    raise IrreversibleMigration
  end
end

Remove SpecialistDocumentEditions w/ non-manual document_type
Remove SpecialistDocumentEditions w/ non-manual document_type

These should've been removed when the related specialist documents were
moved to the newer Specialist Publisher application around the time of
this large commit [1].

I've tested this migration against a dump of the production database
taken on 2017-02-24. I ran the `document_types_report` script before
and after running the migration to confirm that:

* Only SpecialistDocumentEditions with a non-manual document_type were
  affected.

* No ManualRecord::Editions were made childless nor ManualRecords
  made grand-childless. Since it's not currently possible to add
  non-manual SpecialistDocumentEditions via the user interface,
  it's safe to assume that this will continue to be the case in the
  production database until this migration is run.

I've recorded the results of this test in a gist [2]. You can see that
all 23018 SpecialistDocumentEditions with a non-manual document_type
were deleted and 3688 with a manual document_type were left intact.

[1]: 3162f0e72fd53bfd1cf87f5661bb198ff785940e
[2]: https://gist.github.com/floehopper/93d519f75192c356e1b9a0b6151c951c
