]> git.openstreetmap.org Git - rails.git/blobdiff - lib/migrate.rb
migrations: add specific method for nodes/ways/relations enum column
[rails.git] / lib / migrate.rb
index 77bc93646d0eef922d958973e4acd8481df69c79..69538f1da6f86e36628f371e80b5cd55feb65ea3 100644 (file)
@@ -73,6 +73,22 @@ module ActiveRecord
       def innodb_table
         return { :id => false, :force => true, :options => "ENGINE=InnoDB" }
       end
+
+      def innodb_option
+        return "ENGINE=InnoDB"
+      end
+      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
+
+      def alter_column_nwr_enum (table_name, column)
+        execute "alter table #{table_name} change column #{column} #{column} enum('node','way','relation');"
+      end
     end
   end
 end