Skip to content

Commit

Permalink
Allow backticks in gh-ost query (#71)
Browse files Browse the repository at this point in the history
* Allow backticks in gh-ost query

* v0.4.2
  • Loading branch information
Austin C Roos authored Mar 30, 2022
1 parent 8b6e628 commit 3f278fc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def remove_index(table_name, options = {})
attr_reader :database, :dry_run

ALTER_TABLE_PATTERN = /\AALTER\s+TABLE\W*(?<table_name>\w+)\W*(?<query>.*)$/i.freeze
QUERY_ALLOWABLE_CHARS = /[^0-9a-z_\s():'"{},]/i.freeze
QUERY_ALLOWABLE_CHARS = /[^0-9a-z_\s():'"{},`]/i.freeze
CREATE_TABLE_PATTERN = /\Acreate\stable/i.freeze
DROP_TABLE_PATTERN = /\Acreate\stable/i.freeze
INSERT_SCHEMA_MIGRATION_PATTERN = /\Ainsert\sinto\s`schema_migrations`/i.freeze
Expand Down
2 changes: 1 addition & 1 deletion lib/ghost_adapter/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module GhostAdapter
VERSION = '0.4.1'.freeze
VERSION = '0.4.2'.freeze
end
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
'ADD index_type INDEX `baz_index_name` (`baz_id`);;;'

sanatized_sql =
'ADD index_type INDEX bar_index_name (bar_id), '\
'ADD index_type INDEX baz_index_name (baz_id)'
'ADD index_type INDEX `bar_index_name` (`bar_id`), '\
'ADD index_type INDEX `baz_index_name` (`baz_id`)'

expect(GhostAdapter::Migrator).to receive(:execute)
.with(table.to_s, sanatized_sql, any_args)
Expand Down

0 comments on commit 3f278fc

Please sign in to comment.