Rails の migration で生 SQL 実行

Rails の migration で生 SQL 実行

class MigrationFileName < ActiveRecord::Migration[7.0]
    def up
        execute('実行したい生SQL;')
    end
    def down
        execute('実行したい生SQL;')
    end
end

みたいな感じで実行できる。