module Sequent::Migrations::Sql

Public Instance Methods

exec_sql(sql) click to toggle source
# File lib/sequent/migrations/sql.rb, line 14
def exec_sql(sql)
  Sequent::ApplicationRecord.connection.execute(sql)
end
sql_file_to_statements(file_location) { |sql_string| ... } click to toggle source
# File lib/sequent/migrations/sql.rb, line 8
def sql_file_to_statements(file_location)
  sql_string = File.read(file_location, encoding: 'bom|utf-8')
  sql_string = yield(sql_string) if block_given?
  sql_string.split(/;$/).reject { |statement| statement.remove("\n").blank? }
end