Class: Nandi::Instructions::AddForeignKey
- Inherits:
-
Object
- Object
- Nandi::Instructions::AddForeignKey
- Defined in:
- lib/nandi/instructions/add_foreign_key.rb
Instance Attribute Summary collapse
-
#table ⇒ Object
readonly
Returns the value of attribute table.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
-
#validate ⇒ Object
readonly
Returns the value of attribute validate.
Instance Method Summary collapse
- #extra_args ⇒ Object
-
#initialize(table:, target:, name: nil, **extra_args) ⇒ AddForeignKey
constructor
A new instance of AddForeignKey.
- #lock ⇒ Object
- #procedure ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(table:, target:, name: nil, **extra_args) ⇒ AddForeignKey
Returns a new instance of AddForeignKey.
10 11 12 13 14 15 16 |
# File 'lib/nandi/instructions/add_foreign_key.rb', line 10 def initialize(table:, target:, name: nil, **extra_args) @table = table @target = target @extra_args = extra_args @name = name @validate = false end |
Instance Attribute Details
#table ⇒ Object (readonly)
Returns the value of attribute table.
8 9 10 |
# File 'lib/nandi/instructions/add_foreign_key.rb', line 8 def table @table end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
8 9 10 |
# File 'lib/nandi/instructions/add_foreign_key.rb', line 8 def target @target end |
#validate ⇒ Object (readonly)
Returns the value of attribute validate.
8 9 10 |
# File 'lib/nandi/instructions/add_foreign_key.rb', line 8 def validate @validate end |
Instance Method Details
#extra_args ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/nandi/instructions/add_foreign_key.rb', line 26 def extra_args { **@extra_args, name: name, validate: validate, }.compact end |
#lock ⇒ Object
34 35 36 |
# File 'lib/nandi/instructions/add_foreign_key.rb', line 34 def lock Nandi::Migration::LockWeights::ACCESS_EXCLUSIVE end |
#procedure ⇒ Object
18 19 20 |
# File 'lib/nandi/instructions/add_foreign_key.rb', line 18 def procedure :add_foreign_key end |
#validate! ⇒ Object
22 23 24 |
# File 'lib/nandi/instructions/add_foreign_key.rb', line 22 def validate! @validate = true end |