Not special purpose syntax, but you can certainly iterate over an array of table names and perform the same migration steps for each one.
class AddTimeStampsToABandC < ActiveRecord::Migration AFFECTED_TABLES = [:table_a, :table_b, :table_c] def self.up AFFECTED_TABLES.each do |t| add_timestamps(t) end end def self.down AFFECTED_TABLES.each do |t| remove_timestamps(t) end end end
source share