A platform for community discussion. Free, open, simple.
DEV: Add force option to discourse remap command (#27770)
Daniel Waterworth069a0bd6eeb4
diff --git a/script/discourse b/script/discourseindex 65190bfdfb4..5cc8c9d13d4 100755--- a/script/discourse+++ b/script/discourse@@ -8,7 +8,7 @@ class DiscourseCLI < Thortrueend- 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 <<-TEXTReplace a string sequence FROM with TO across all tables.@@ -33,6 +33,7 @@ class DiscourseCLI < ThorTEXToption :global, type: :booleanoption :regex, type: :boolean+ option :force, type: :booleandef remap(from, to)load_rails@@ -48,10 +49,12 @@ class DiscourseCLI < Thorputs "WILL RUN ON '#{RailsMultisite::ConnectionManagement.current_db}' DB"end- puts "THIS TASK WILL REWRITE DATA, ARE YOU SURE (type YES)"- if STDIN.gets.strip.upcase != "YES"- puts "aborting."- exit 1+ unless options[:force]+ puts "THIS TASK WILL REWRITE DATA, ARE YOU SURE (type YES)"+ if STDIN.gets.strip.upcase != "YES"+ puts "aborting."+ exit 1+ endendif options[:global]