class CreateArticles < ActiveRecord::Migration[5.1]
  def change
    create_table :articles do |t|
      t.string :title
      t.text :text

      t.timestamps
    end
  end
end

superclass = if Gem::Version.new(Rails.version) >= Gem::Version.new(5)
              ActiveRecord::Migration[5.0]
            else
              ActiveRecord::Migration
            end

class CreateArticles < superclass
  def change
    create_table :articles do |t|
      t.string :title
      t.text :text

      t.timestamps
    end
  end
end

Fix migration class to be compatible with Rails versions < 5
Fix migration class to be compatible with Rails versions < 5
