mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 06:43:45 +08:00
DEV: Add force option to discourse remap command (#27770)
This commit is contained in:
parent
ae79ba1447
commit
069a0bd6ee
|
@ -8,7 +8,7 @@ class DiscourseCLI < Thor
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "remap [--global,--regex] FROM TO", "Remap a string sequence across all tables"
|
desc "remap [--global,--regex,--force] FROM TO", "Remap a string sequence across all tables"
|
||||||
long_desc <<-TEXT
|
long_desc <<-TEXT
|
||||||
Replace a string sequence FROM with TO across all tables.
|
Replace a string sequence FROM with TO across all tables.
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ class DiscourseCLI < Thor
|
||||||
TEXT
|
TEXT
|
||||||
option :global, type: :boolean
|
option :global, type: :boolean
|
||||||
option :regex, type: :boolean
|
option :regex, type: :boolean
|
||||||
|
option :force, type: :boolean
|
||||||
def remap(from, to)
|
def remap(from, to)
|
||||||
load_rails
|
load_rails
|
||||||
|
|
||||||
|
@ -48,10 +49,12 @@ class DiscourseCLI < Thor
|
||||||
puts "WILL RUN ON '#{RailsMultisite::ConnectionManagement.current_db}' DB"
|
puts "WILL RUN ON '#{RailsMultisite::ConnectionManagement.current_db}' DB"
|
||||||
end
|
end
|
||||||
|
|
||||||
puts "THIS TASK WILL REWRITE DATA, ARE YOU SURE (type YES)"
|
unless options[:force]
|
||||||
if STDIN.gets.strip.upcase != "YES"
|
puts "THIS TASK WILL REWRITE DATA, ARE YOU SURE (type YES)"
|
||||||
puts "aborting."
|
if STDIN.gets.strip.upcase != "YES"
|
||||||
exit 1
|
puts "aborting."
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if options[:global]
|
if options[:global]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user