]> git.openstreetmap.org Git - rails.git/blob - app/models/old_relation_tag.rb
Merge remote-tracking branch 'upstream/pull/4759'
[rails.git] / app / models / old_relation_tag.rb
1 # == Schema Information
2 #
3 # Table name: relation_tags
4 #
5 #  relation_id :bigint(8)        not null, primary key
6 #  k           :string           default(""), not null, primary key
7 #  v           :string           default(""), not null
8 #  version     :bigint(8)        not null, primary key
9 #
10 # Foreign Keys
11 #
12 #  relation_tags_id_fkey  (["relation_id", "version"] => relations.["relation_id", "version"])
13 #
14
15 class OldRelationTag < ApplicationRecord
16   self.table_name = "relation_tags"
17
18   belongs_to :old_relation, :query_constraints => [:relation_id, :version], :inverse_of => :old_tags
19
20   validates :old_relation, :associated => true
21   validates :k, :v, :allow_blank => true, :length => { :maximum => 255 }, :characters => true
22   validates :k, :uniqueness => { :scope => [:relation_id, :version] }
23 end