aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v2/db_drop.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v2/db_drop.rb')
-rw-r--r--lib/sisu/v2/db_drop.rb85
1 files changed, 44 insertions, 41 deletions
diff --git a/lib/sisu/v2/db_drop.rb b/lib/sisu/v2/db_drop.rb
index 35d971af..edd08345 100644
--- a/lib/sisu/v2/db_drop.rb
+++ b/lib/sisu/v2/db_drop.rb
@@ -133,50 +133,53 @@ module SiSU_DB_drop
ensure
end
end
- def conn_execute_array(sql_arr)
- @conn.transaction do |conn|
- sql_arr.each do |sql|
- conn.execute(sql)
+ def indexes
+ def conn_execute_array(sql_arr)
+ @conn.transaction do |conn|
+ sql_arr.each do |sql|
+ conn.execute(sql)
+ end
end
end
+ def base #% drop base indexes
+ print "\n drop documents common indexes\n" unless @opt.cmd =~/q/
+ sql_arr=[
+ %{DROP INDEX idx_title;},
+ %{DROP INDEX idx_author;},
+ %{DROP INDEX idx_filename;},
+ %{DROP INDEX idx_topics;},
+ %{DROP INDEX idx_ocn;},
+ %{DROP INDEX idx_digest_clean;},
+ %{DROP INDEX idx_digest_all;},
+ %{DROP INDEX idx_lev1;},
+ %{DROP INDEX idx_lev2;},
+ %{DROP INDEX idx_lev3;},
+ %{DROP INDEX idx_lev4;},
+ %{DROP INDEX idx_lev5;},
+ %{DROP INDEX idx_lev6;},
+ %{DROP INDEX idx_endnote_nr;},
+ %{DROP INDEX idx_digest_en;},
+ %{DROP INDEX idx_endnote_nr_asterisk;},
+ %{DROP INDEX idx_endnote_asterisk;},
+ %{DROP INDEX idx_digest_en_asterisk;},
+ %{DROP INDEX idx_endnote_nr_plus;},
+ %{DROP INDEX idx_endnote_plus;},
+ %{DROP INDEX idx_digest_en_plus},
+ ]
+ conn_execute_array(sql_arr)
+ end
+ def text #% drop TEXT indexes, sqlite
+ print "\n drop documents TEXT indexes\n" unless @opt.cmd =~/q/
+ sql_arr=[
+ %{DROP INDEX idx_clean;},
+ %{DROP INDEX idx_endnote},
+ ]
+ conn_execute_array(sql_arr)
+ end
+ self
end
- def indexes #% drop all indexes
- print "\n drop documents common indexes\n" unless @opt.cmd =~/q/
- sql_arr=[
- %{DROP INDEX idx_text_words;},
- %{DROP INDEX idx_title;},
- %{DROP INDEX idx_author;},
- %{DROP INDEX idx_filename;},
- %{DROP INDEX idx_topics;},
- %{DROP INDEX idx_ocn;},
- %{DROP INDEX idx_digest_clean;},
- %{DROP INDEX idx_digest_all;},
- %{DROP INDEX idx_lev1;},
- %{DROP INDEX idx_lev2;},
- %{DROP INDEX idx_lev3;},
- %{DROP INDEX idx_lev4;},
- %{DROP INDEX idx_lev5;},
- %{DROP INDEX idx_lev6;},
- %{DROP INDEX idx_endnote_words;},
- %{DROP INDEX idx_endnote_nr;},
- %{DROP INDEX idx_digest_en;},
- %{DROP INDEX idx_endnote_words_asterisk;},
- %{DROP INDEX idx_endnote_nr_asterisk;},
- %{DROP INDEX idx_endnote_asterisk;},
- %{DROP INDEX idx_digest_en_asterisk;},
- %{DROP INDEX idx_endnote_words_plus;},
- %{DROP INDEX idx_endnote_nr_plus;},
- %{DROP INDEX idx_endnote_plus;},
- %{DROP INDEX idx_digest_en_plus},
- ]
- conn_execute_array(sql_arr)
- print "\n drop documents TEXT indexes\n" unless @opt.cmd =~/q/
- sql_arr=[
- %{DROP INDEX idx_clean;},
- %{DROP INDEX idx_endnote},
- ]
- conn_execute_array(sql_arr)
- end
+ indexes.base
+ @opt.cmd=~/D/ || ((@opt.mod=~/psql/) ? '' : indexes.text)
self
end
end