Class: Gitlab::Database::Partitioning::ReplaceTable
- Inherits:
-
Object
- Object
- Gitlab::Database::Partitioning::ReplaceTable
- Defined in:
- lib/gitlab/database/partitioning/replace_table.rb
Constant Summary collapse
- DELIMITER =
";\n\n"
Instance Attribute Summary collapse
-
#original_primary_key ⇒ Object
readonly
Returns the value of attribute original_primary_key.
-
#original_table ⇒ Object
readonly
Returns the value of attribute original_table.
-
#primary_key_column ⇒ Object
readonly
Returns the value of attribute primary_key_column.
-
#replaced_primary_key ⇒ Object
readonly
Returns the value of attribute replaced_primary_key.
-
#replaced_table ⇒ Object
readonly
Returns the value of attribute replaced_table.
-
#replacement_primary_key ⇒ Object
readonly
Returns the value of attribute replacement_primary_key.
-
#replacement_table ⇒ Object
readonly
Returns the value of attribute replacement_table.
-
#sequence ⇒ Object
readonly
Returns the value of attribute sequence.
Instance Method Summary collapse
-
#initialize(connection, original_table, replacement_table, replaced_table, primary_key_column) ⇒ ReplaceTable
constructor
A new instance of ReplaceTable.
- #perform {|sql_to_replace_table| ... } ⇒ Object
Constructor Details
#initialize(connection, original_table, replacement_table, replaced_table, primary_key_column) ⇒ ReplaceTable
Returns a new instance of ReplaceTable.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/gitlab/database/partitioning/replace_table.rb', line 12 def initialize(connection, original_table, replacement_table, replaced_table, primary_key_column) @connection = connection @original_table = original_table @replacement_table = replacement_table @replaced_table = replaced_table @primary_key_column = primary_key_column @sequence = default_sequence(original_table, primary_key_column) @original_primary_key = default_primary_key(original_table) @replacement_primary_key = default_primary_key(replacement_table) @replaced_primary_key = default_primary_key(replaced_table) end |
Instance Attribute Details
#original_primary_key ⇒ Object (readonly)
Returns the value of attribute original_primary_key.
9 10 11 |
# File 'lib/gitlab/database/partitioning/replace_table.rb', line 9 def original_primary_key @original_primary_key end |
#original_table ⇒ Object (readonly)
Returns the value of attribute original_table.
9 10 11 |
# File 'lib/gitlab/database/partitioning/replace_table.rb', line 9 def original_table @original_table end |
#primary_key_column ⇒ Object (readonly)
Returns the value of attribute primary_key_column.
9 10 11 |
# File 'lib/gitlab/database/partitioning/replace_table.rb', line 9 def primary_key_column @primary_key_column end |
#replaced_primary_key ⇒ Object (readonly)
Returns the value of attribute replaced_primary_key.
9 10 11 |
# File 'lib/gitlab/database/partitioning/replace_table.rb', line 9 def replaced_primary_key @replaced_primary_key end |
#replaced_table ⇒ Object (readonly)
Returns the value of attribute replaced_table.
9 10 11 |
# File 'lib/gitlab/database/partitioning/replace_table.rb', line 9 def replaced_table @replaced_table end |
#replacement_primary_key ⇒ Object (readonly)
Returns the value of attribute replacement_primary_key.
9 10 11 |
# File 'lib/gitlab/database/partitioning/replace_table.rb', line 9 def replacement_primary_key @replacement_primary_key end |
#replacement_table ⇒ Object (readonly)
Returns the value of attribute replacement_table.
9 10 11 |
# File 'lib/gitlab/database/partitioning/replace_table.rb', line 9 def replacement_table @replacement_table end |
#sequence ⇒ Object (readonly)
Returns the value of attribute sequence.
9 10 11 |
# File 'lib/gitlab/database/partitioning/replace_table.rb', line 9 def sequence @sequence end |
Instance Method Details
#perform {|sql_to_replace_table| ... } ⇒ Object
25 26 27 28 29 |
# File 'lib/gitlab/database/partitioning/replace_table.rb', line 25 def perform yield sql_to_replace_table if block_given? execute(sql_to_replace_table) end |