]> git.openstreetmap.org Git - rails.git/blobdiff - db/migrate/020_populate_node_tags_and_remove.rb
Merge branch 'pull/3024'
[rails.git] / db / migrate / 020_populate_node_tags_and_remove.rb
index 2a81a2b9a2c863b4899a6cf28aa9504f7f9f6faf..c8c017806a2964466cc28debdf6763f37f7f890f 100644 (file)
@@ -1,6 +1,4 @@
-require "migrate"
-
-class PopulateNodeTagsAndRemove < ActiveRecord::Migration[5.0]
+class PopulateNodeTagsAndRemove < ActiveRecord::Migration[4.2]
   def self.up
     have_nodes = select_value("SELECT count(*) FROM current_nodes").to_i.nonzero?
 
@@ -14,7 +12,7 @@ class PopulateNodeTagsAndRemove < ActiveRecord::Migration[5.0]
           "#{src} -o #{cmd}") || raise
       end
 
-      conn_opts = ActiveRecord::Base.connection.instance_eval { @connection_options }
+      conn_opts = ApplicationRecord.connection.instance_eval { @connection_options }
       args = conn_opts.map(&:to_s) + [prefix]
       raise "#{cmd} failed" unless system cmd, *args
 
@@ -38,8 +36,8 @@ class PopulateNodeTagsAndRemove < ActiveRecord::Migration[5.0]
     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
+      t.column :k,           :string, :default => "", :null => false
+      t.column :v,           :string, :default => "", :null => false
     end
 
     # now get the data back