class SetFileSizeNotNullInProjectFiles < ActiveRecord::Migration
  def self.up
    #deletes all files with file_size NULL
    ProjectFile.where("file_file_size IS NULL").each do |f|
      f.destroy
    end

    change_column_null(:project_files, :file_file_size, false)
  end

  def self.down
    change_column_null(:project_files, :file_file_size, true)
  end
end

class SetFileSizeNotNullInProjectFiles < ActiveRecord::Migration
  def self.up
    #deletes all files with file_size NULL
    execute("DELETE FROM `project_files` WHERE `file_file_size` IS NULL")
    change_column_null(:project_files, :file_file_size, false)
  end

  def self.down
    change_column_null(:project_files, :file_file_size, true)
  end
end

Fix migration which doesn't work unless you update your code one commit at a time.
Fix migration which doesn't work unless you update your code one commit at a time.

Nugi, don't write this type of code in migrations. Stick to SQL commands and simple migration tasks.
