]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/old_way_node.rb
Replace composite_primary_keys with rails builtin support
[rails.git] / app / models / old_way_node.rb
index 23ff503edf665ff922e6fe4b874f5484734f488f..e031aba10f2bd47f269e5eea19eb5958dffe7cb1 100644 (file)
@@ -1,8 +1,25 @@
-class OldWayNode < ActiveRecord::Base
+# == Schema Information
+#
+# Table name: way_nodes
+#
+#  way_id      :bigint(8)        not null, primary key
+#  node_id     :bigint(8)        not null
+#  version     :bigint(8)        not null, primary key
+#  sequence_id :bigint(8)        not null, primary key
+#
+# Indexes
+#
+#  way_nodes_node_idx  (node_id)
+#
+# Foreign Keys
+#
+#  way_nodes_id_fkey  (["way_id", "version"] => ways.["way_id", "version"])
+#
+
+class OldWayNode < ApplicationRecord
   self.table_name = "way_nodes"
-  self.primary_keys = "way_id", "version", "sequence_id"
 
-  belongs_to :old_way, :foreign_key => [:way_id, :version]
+  belongs_to :old_way, :query_constraints => [:way_id, :version], :inverse_of => :old_nodes
   # A bit messy, referring to current nodes and ways, should do for the data browser for now
   belongs_to :node
   belongs_to :way