Module: ZeroDowntimeMigrations::DSL

Included in:
Migration
Defined in:
lib/zero_downtime_migrations/dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#currentObject

Returns the value of attribute current.



3
4
5
# File 'lib/zero_downtime_migrations/dsl.rb', line 3

def current
  @current
end

#dataObject

Returns the value of attribute data.



3
4
5
# File 'lib/zero_downtime_migrations/dsl.rb', line 3

def data
  @data
end

#ddlObject

Returns the value of attribute ddl.



3
4
5
# File 'lib/zero_downtime_migrations/dsl.rb', line 3

def ddl
  @ddl
end

#indexObject

Returns the value of attribute index.



3
4
5
# File 'lib/zero_downtime_migrations/dsl.rb', line 3

def index
  @index
end

#safeObject

Returns the value of attribute safe.



3
4
5
# File 'lib/zero_downtime_migrations/dsl.rb', line 3

def safe
  @safe
end

Instance Method Details

#data?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/zero_downtime_migrations/dsl.rb', line 5

def data?
  !!@data
end

#ddl?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/zero_downtime_migrations/dsl.rb', line 9

def ddl?
  !!@ddl
end

#index?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/zero_downtime_migrations/dsl.rb', line 13

def index?
  !!@index
end

#migrating?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/zero_downtime_migrations/dsl.rb', line 17

def migrating?
  !!@current
end

#mixed?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/zero_downtime_migrations/dsl.rb', line 21

def mixed?
  [data?, ddl?, index?].select(&:itself).size > 1
end

#safe?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/zero_downtime_migrations/dsl.rb', line 25

def safe?
  !!@safe || ENV["SAFETY_ASSURED"].presence
end

#safety_assuredObject



29
30
31
# File 'lib/zero_downtime_migrations/dsl.rb', line 29

def safety_assured
  Migration.safe = true
end

#unsafe?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/zero_downtime_migrations/dsl.rb', line 33

def unsafe?
  !safe?
end