module WTOSC::MigrationHelper

Public Instance Methods

add_column(table_name, column, type) click to toggle source

TODO: add more methods

# File lib/migration_helper.rb, line 21
def add_column(table_name, column, type)
  query = {
    table: table_name.to_s,
    query: "ADD COLUMN #{column} #{TypeFetcher.fetch(type)}"
  }

  queries.push(query)
end
migrate!(options = {}) click to toggle source
# File lib/migration_helper.rb, line 30
def migrate!(options = {})
  Executor.new(
    queries,
    WTOSC.configuration.default_options.merge(options),
    before: WTOSC.configuration.before_hooks,
    after: WTOSC.configuration.after_hooks
  ).execute!
end
queries() click to toggle source
# File lib/migration_helper.rb, line 16
def queries
  @queries ||= []
end