Here's the Ruby on Rails migration implementation:
class AddPersianCalendarFunctionsToDb < ActiveRecord::Migration[4.2]
def up
execute(
<<-EOSQL
DROP FUNCTION IF EXISTS startOfJalaaliMonth(timestamp);
| function iso7064Mod97_10(iban) { | |
| var remainder = iban, | |
| block; | |
| while (remainder.length > 2){ | |
| block = remainder.slice(0, 9); | |
| remainder = parseInt(block, 10) % 97 + remainder.slice(block.length); | |
| } | |
| return parseInt(remainder, 10) % 97; |