Class: PerconaMigrator::AlterArgument
- Inherits:
-
Object
- Object
- PerconaMigrator::AlterArgument
- Defined in:
- lib/percona_migrator/alter_argument.rb
Overview
Represents the ‘–alter’ argument of Percona’s pt-online-schema-change See www.percona.com/doc/percona-toolkit/2.0/pt-online-schema-change.html
Constant Summary collapse
- ALTER_TABLE_REGEX =
/\AALTER TABLE `(\w+)` /
Instance Attribute Summary collapse
-
#table_name ⇒ Object
readonly
Returns the value of attribute table_name.
Instance Method Summary collapse
-
#initialize(statement) ⇒ AlterArgument
constructor
Constructor.
-
#to_s ⇒ Object
Returns the ‘–alter’ pt-online-schema-change argument as a string.
Constructor Details
#initialize(statement) ⇒ AlterArgument
Constructor
15 16 17 18 19 20 21 22 |
# File 'lib/percona_migrator/alter_argument.rb', line 15 def initialize(statement) @statement = statement match = statement.match(ALTER_TABLE_REGEX) raise InvalidAlterStatement unless match @table_name = match.captures[0] end |
Instance Attribute Details
#table_name ⇒ Object (readonly)
Returns the value of attribute table_name.
9 10 11 |
# File 'lib/percona_migrator/alter_argument.rb', line 9 def table_name @table_name end |
Instance Method Details
#to_s ⇒ Object
Returns the ‘–alter’ pt-online-schema-change argument as a string. See www.percona.com/doc/percona-toolkit/2.0/pt-online-schema-change.html
26 27 28 |
# File 'lib/percona_migrator/alter_argument.rb', line 26 def to_s "--alter \"#{parsed_statement}\"" end |