[Groonga-commit] droonga/droonga-engine at 5110bc5 [master] Put "device" part after the base path of databases.

アーカイブの一覧に戻る

YUKI Hiroshi null+****@clear*****
Fri Nov 7 13:38:18 JST 2014


YUKI Hiroshi	2014-11-07 13:38:18 +0900 (Fri, 07 Nov 2014)

  New Revision: 5110bc54eeea61ad56e7d6a0620565c48303a606
  https://github.com/droonga/droonga-engine/commit/5110bc54eeea61ad56e7d6a0620565c48303a606

  Message:
    Put "device" part after the base path of databases.
    
    And, migrate database location from multiple cases.

  Modified files:
    lib/droonga/catalog/version2.rb

  Modified: lib/droonga/catalog/version2.rb (+14 -7)
===================================================================
--- lib/droonga/catalog/version2.rb    2014-11-07 13:29:37 +0900 (99fc367)
+++ lib/droonga/catalog/version2.rb    2014-11-07 13:38:18 +0900 (0b0824c)
@@ -89,14 +89,21 @@ module Droonga
       end
 
       def migrate_database_location(device, name)
-        common_base_path = Pathname(base_path) + device
-        old_db_dir_path = common_base_path + name
-        old_db_path = old_db_dir_path + "db"
-        current_db_dir_path = common_base_path + Path.databases.basename + name
+        current_db_dir_path = Path.databases + device + name
         current_db_path = current_db_dir_path + "db"
-        if old_db_path.exist? and not current_db_path.exist?
-          FileUtils.mkdir_p(current_db_dir_path.parent)
-          FileUtils.move(old_db_dir_path, current_db_dir_path)
+        return if current_db_path.exist?
+
+        common_base_path = Pathname(base_path)
+        old_db_path = {
+          :top_level     => common_base_path + device + name + "db",
+          :singular_form => common_base_path + device + "database" + name + "db",
+        }
+        old_db_path.each do |type, old_db_path|
+          if old_db_path.exist?
+            FileUtils.mkdir_p(current_db_dir_path.parent)
+            FileUtils.move(old_db_path.parent, current_db_dir_path)
+            return
+          end
         end
       end
     end
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る