debian-mirror-gitlab/lib/gitlab/database/postgres_foreign_key.rb
2021-10-27 15:23:28 +05:30

16 lines
429 B
Ruby

# frozen_string_literal: true
module Gitlab
module Database
class PostgresForeignKey < ApplicationRecord
self.primary_key = :oid
scope :by_referenced_table_identifier, ->(identifier) do
raise ArgumentError, "Referenced table name is not fully qualified with a schema: #{identifier}" unless identifier =~ /^\w+\.\w+$/
where(referenced_table_identifier: identifier)
end
end
end
end