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.rb72
1 files changed, 42 insertions, 30 deletions
diff --git a/lib/sisu/v2/db_drop.rb b/lib/sisu/v2/db_drop.rb
index 7189da56..35d971af 100644
--- a/lib/sisu/v2/db_drop.rb
+++ b/lib/sisu/v2/db_drop.rb
@@ -133,37 +133,49 @@ 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)
+ end
+ end
+ end
def indexes #% drop all indexes
- #@conn.do(%{
- # DROP INDEX object_nr ON doc_objects(ocn);
- # DROP INDEX body ON doc_objects(body);
- # DROP INDEX clean ON doc_objects(clean);
- # DROP INDEX lev1 ON doc_objects(lev1);
- # DROP INDEX lev2 ON doc_objects(lev2);
- # DROP INDEX lev3 ON doc_objects(lev3);
- # DROP INDEX lev4 ON doc_objects(lev4);
- # DROP INDEX lev5 ON doc_objects(lev5);
- # DROP INDEX lev6 ON doc_objects(lev6);
- # DROP INDEX endnote_nr ON endnotes(nr);
- # DROP INDEX endnote ON endnotes(body);
- # DROP INDEX title ON metadata_and_text(title);
- # DROP INDEX filename ON metadata_and_text(filename)
- # /*
- # DROP INDEX object_nr ON doc_objects(ocn) CASCADE;
- # DROP INDEX body ON doc_objects(body) CASCADE;
- # DROP INDEX clean ON doc_objects(clean) CASCADE;
- # DROP INDEX lev1 ON doc_objects(lev1) CASCADE;
- # DROP INDEX lev2 ON doc_objects(lev2) CASCADE;
- # DROP INDEX lev3 ON doc_objects(lev3) CASCADE;
- # DROP INDEX lev4 ON doc_objects(lev4) CASCADE;
- # DROP INDEX lev5 ON doc_objects(lev5) CASCADE;
- # DROP INDEX lev6 ON doc_objects(lev6) CASCADE;
- # DROP INDEX endnote_nr ON endnotes(nr) CASCADE;
- # DROP INDEX endnote ON endnotes(body) CASCADE;
- # DROP INDEX title ON metadata_and_text(title) CASCADE;
- # DROP INDEX filename ON metadata_and_text(filename) CASCADE
- # */
- #})
+ 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
self
end