Class: Physique::FluentMigrator::Config

Inherits:
Object
  • Object
show all
Extended by:
Albacore::ConfigDSL
Includes:
Albacore::CmdConfig, ToolLocator
Defined in:
lib/physique/tasks/fluent_migrator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ToolLocator

#locate_tool, #lookup_tool, #register_tool, #which

Instance Attribute Details

#database=(value) ⇒ Object (writeonly)

SQL Server database



48
49
50
# File 'lib/physique/tasks/fluent_migrator.rb', line 48

def database=(value)
  @database = value
end

#dialect=(value) ⇒ Object (writeonly)

SQL dialect



51
52
53
# File 'lib/physique/tasks/fluent_migrator.rb', line 51

def dialect=(value)
  @dialect = value
end

#steps=(value) ⇒ Object (writeonly)

Number of steps to rollback



77
78
79
# File 'lib/physique/tasks/fluent_migrator.rb', line 77

def steps=(value)
  @steps = value
end

#task=(value) ⇒ Object (writeonly)

Migration task



71
72
73
# File 'lib/physique/tasks/fluent_migrator.rb', line 71

def task=(value)
  @task = value
end

#timeout=(value) ⇒ Object (writeonly)

Timeout



83
84
85
# File 'lib/physique/tasks/fluent_migrator.rb', line 83

def timeout=(value)
  @timeout = value
end

#verbose=(value) ⇒ Object (writeonly)

Verbosity



80
81
82
# File 'lib/physique/tasks/fluent_migrator.rb', line 80

def verbose=(value)
  @verbose = value
end

#version=(value) ⇒ Object (writeonly)

Version number to migrate to



74
75
76
# File 'lib/physique/tasks/fluent_migrator.rb', line 74

def version=(value)
  @version = value
end

Instance Method Details

#deepObject



66
67
68
# File 'lib/physique/tasks/fluent_migrator.rb', line 66

def deep
  @nested = true
end

#namespace=(val) ⇒ Object

Namespace of migration to run



57
58
59
60
# File 'lib/physique/tasks/fluent_migrator.rb', line 57

def namespace=(val)
  @namespace = val
  @nested = true
end

#optsObject

Raises:

  • (ArgumentError)


107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# 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_fileObject



88
89
90
91
# File 'lib/physique/tasks/fluent_migrator.rb', line 88

def output_to_file
  # Set a default output file
  @output_file = "#{@database}-output.sql"
end

#previewObject



97
98
99
# File 'lib/physique/tasks/fluent_migrator.rb', line 97

def preview
  @preview = true
end

#shallowObject



62
63
64
# File 'lib/physique/tasks/fluent_migrator.rb', line 62

def shallow
  @nested = false
end

#transaction_per_sessionObject



93
94
95
# File 'lib/physique/tasks/fluent_migrator.rb', line 93

def transaction_per_session
  @tps = true
end