class Physique::FluentMigrator::Config

Attributes

database[W]

SQL Server database

dialect[W]

SQL dialect

steps[W]

Number of steps to rollback

task[W]

Migration task

timeout[W]

Timeout

verbose[W]

Verbosity

version[W]

Version number to migrate to

Public Instance Methods

deep() click to toggle source
# File lib/physique/tasks/fluent_migrator.rb, line 66
def deep
  @nested = true
end
namespace=(val) click to toggle source

Namespace of migration to run

# File lib/physique/tasks/fluent_migrator.rb, line 57
def namespace=(val)
  @namespace = val
  @nested = true
end
opts() click to toggle source
# File lib/physique/tasks/fluent_migrator.rb, line 107
def opts
  raise ArgumentError, 'You must specify a server name' if @instance.blank?
  raise ArgumentError, 'You must specify a database name' if @database.blank?
  raise ArgumentError, 'You must specify the path to the migrator executable' if @exe.blank?
  raise ArgumentError, 'You must specify a migration dll' if @dll.blank?
  raise ArgumentError, 'You must specify a valid task' unless valid_tasks.include? @task

  Map.new({
    connection_string: connection_string,
    dialect: @dialect,
    dll: @dll,
    namespace: @namespace,
    nested: @nested,
    task: @task,
    version: @version,
    steps: @steps,
    verbose: @verbose,
    output_file: @output_file,
    exe: @exe,
    tps: @tps,
    preview: @preview,
    timeout: @timeout,
  }).apply(
    dialect: 'SqlServer2008',
    verbose: true,
    version: 0,
    steps: 1,
    timeout: 30 # seconds
  )
end
output_to_file() click to toggle source
# File lib/physique/tasks/fluent_migrator.rb, line 88
def output_to_file
  # Set a default output file
  @output_file = "#{@database}-output.sql"
end
preview() click to toggle source
# File lib/physique/tasks/fluent_migrator.rb, line 97
def preview
  @preview = true
end
shallow() click to toggle source
# File lib/physique/tasks/fluent_migrator.rb, line 62
def shallow
  @nested = false
end
transaction_per_session() click to toggle source
# File lib/physique/tasks/fluent_migrator.rb, line 93
def transaction_per_session
  @tps = true
end

Private Instance Methods

connection_string() click to toggle source
# File lib/physique/tasks/fluent_migrator.rb, line 140
def connection_string
  "Data Source=#{@instance};Initial Catalog=#{@database};Integrated Security=True;"
end
valid_tasks() click to toggle source
# File lib/physique/tasks/fluent_migrator.rb, line 144
def valid_tasks
   %w{migrate:up migrate migrate:down rollback rollback:toversion rollback:all validateversionorder listmigrations}
end