X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/fd6f00b069af5a7b87227ea4c3401dc461d7311a..34e3e51456774127d43408b7ab65c24f41373f62:/db/migrate/020_populate_node_tags_and_remove.rb diff --git a/db/migrate/020_populate_node_tags_and_remove.rb b/db/migrate/020_populate_node_tags_and_remove.rb index dc048f190..b5932bbe8 100644 --- a/db/migrate/020_populate_node_tags_and_remove.rb +++ b/db/migrate/020_populate_node_tags_and_remove.rb @@ -1,3 +1,5 @@ +require 'migrate' + class PopulateNodeTagsAndRemove < ActiveRecord::Migration def self.up have_nodes = select_value("SELECT count(*) FROM current_nodes").to_i != 0 @@ -7,7 +9,7 @@ class PopulateNodeTagsAndRemove < ActiveRecord::Migration cmd = "db/migrate/020_populate_node_tags_and_remove_helper" src = "#{cmd}.c" - if not File.exists? cmd or File.mtime(cmd) < File.mtime(src) then + if not File.exists? cmd or File.mtime(cmd) < File.mtime(src) then system 'cc -O3 -Wall `mysql_config --cflags --libs` ' + "#{src} -o #{cmd}" or fail end @@ -25,17 +27,17 @@ class PopulateNodeTagsAndRemove < ActiveRecord::Migration remove_column :nodes, :tags remove_column :current_nodes, :tags - add_column :nodes, :version, :bigint, :limit => 20, :null => false + add_column :nodes, :version, :bigint, :null => false - create_table :current_node_tags, innodb_table do |t| - t.column :id, :bigint, :limit => 64, :null => false + create_table :current_node_tags, :id => false do |t| + t.column :id, :bigint, :null => false t.column :k, :string, :default => "", :null => false t.column :v, :string, :default => "", :null => false end - create_table :node_tags, innodb_table do |t| - t.column :id, :bigint, :limit => 64, :null => false - t.column :version, :bigint, :limit => 20, :null => false + create_table :node_tags, :id => false do |t| + t.column :id, :bigint, :null => false + t.column :version, :bigint, :null => false t.column :k, :string, :default => "", :null => false t.column :v, :string, :default => "", :null => false end @@ -53,7 +55,7 @@ class PopulateNodeTagsAndRemove < ActiveRecord::Migration end def self.down - raise IrreversibleMigration.new + raise ActiveRecord::IrreversibleMigration # add_column :nodes, "tags", :text, :default => "", :null => false # add_column :current_nodes, "tags", :text, :default => "", :null => false end