I would like to discuss the idea of throwing an error if an index is added in a migration that references a column that does not exist at the time of migration. Currently in MySQL, when you add an index on a column that does not exist then MySQL will throw an error. In SQLite, no error will be thrown. The error would be encountered by the user at runtime.
Consider the following migrations:
class CreateApplications < ActiveRecord::Migration[5.1] def change create_table :applications do |t| t.string :name
class CreateVersions < ActiveRecord::Migration[5.1] def change create_table :versions do |t| t.string :name t.references :application, foreign_key: true t.index [:application, :name], unique: true
Has this ever come up for anybody else? I was considering my first contribution to the code base and thought this might be a good addition, but was hoping for a consensus before starting work.