]> git.openstreetmap.org Git - rails.git/commitdiff
move fulltext indexes to monkeypatch, since not all dbs have a fulltext analogue
authorAndy Allan <gravitystorm@gmail.com>
Sat, 8 Nov 2008 18:44:38 +0000 (18:44 +0000)
committerAndy Allan <gravitystorm@gmail.com>
Sat, 8 Nov 2008 18:44:38 +0000 (18:44 +0000)
db/migrate/001_create_osm_db.rb
db/migrate/007_add_relations.rb
lib/migrate.rb

index 998e12951795555880a8841579ef8fcc1b8a52a1..3e3377921df5fa4504c7da242dcce94d648c2521 100644 (file)
@@ -50,7 +50,7 @@ class CreateOsmDb < ActiveRecord::Migration
     end
 
     add_index "current_way_tags", ["id"], :name => "current_way_tags_id_idx"
-    execute "CREATE FULLTEXT INDEX `current_way_tags_v_idx` ON `current_way_tags` (`v`)"
+    add_fulltext_index "current_way_tags", "v"
 
     create_table "current_ways", myisam_table do |t|
       t.column "id",        :bigint_pk_64, :null => false
index dea777d5d24292e9acb409b2ababe4196bc9d884..b4aff6e09e6decf1eb1f3a54c6d037604ce99d8d 100644 (file)
@@ -24,7 +24,7 @@ class AddRelations < ActiveRecord::Migration
     end
 
     add_index "current_relation_tags", ["id"], :name => "current_relation_tags_id_idx"
-    execute "CREATE FULLTEXT INDEX `current_relation_tags_v_idx` ON `current_relation_tags` (`v`)"
+    add_fulltext_index "current_relation_tags", "v"
 
     create_table "current_relations", innodb_table do |t|
       t.column "id",        :bigint_pk_64,           :null => false
index df7e5f7aee91d08d3aaf345ca27d0dd6bdfd7393..585b47b1ca624d7bfc2cad06f7dd24432cb8857f 100644 (file)
@@ -81,6 +81,10 @@ module ActiveRecord
       def change_engine (table_name, engine)
         execute "ALTER TABLE #{table_name} ENGINE = #{engine}"
       end
+
+      def add_fulltext_index (table_name, column)
+        execute "CREATE FULLTEXT INDEX `#{table_name}_#{column}_idx` ON `#{table_name}` (`#{column}`)"
+      end
     end
   end
 end