attributes do
integer_primary_key :id
attribute :target_type, Safari.Types.LithostratTargetType, public?: true, allow_nil?: false
attribute :target_id, :integer, public?: true, allow_nil?: false
create_timestamp :inserted_at, public?: true
update_timestamp :updated_at, public?: true
end
relationships do
belongs_to :parent, Safari.Outcrop.Outcrop, public?: true, allow_nil?: false
has_one :group, Safari.Wiki.Group,
source_attribute: :target_id,
destination_attribute: :id,
filter: expr(parent(target_type) == :group)
has_one :formation, Safari.Wiki.Formation,
source_attribute: :target_id,
destination_attribute: :id,
filter: expr(parent(target_type) == :formation)
has_one :member, Safari.Wiki.Member,
source_attribute: :target_id,
destination_attribute: :id,
filter: expr(parent(target_type) == :member)
end
attributes do
integer_primary_key :id
attribute :target_type, Safari.Types.LithostratTargetType, public?: true, allow_nil?: false
attribute :target_id, :integer, public?: true, allow_nil?: false
create_timestamp :inserted_at, public?: true
update_timestamp :updated_at, public?: true
end
relationships do
belongs_to :parent, Safari.Outcrop.Outcrop, public?: true, allow_nil?: false
has_one :group, Safari.Wiki.Group,
source_attribute: :target_id,
destination_attribute: :id,
filter: expr(parent(target_type) == :group)
has_one :formation, Safari.Wiki.Formation,
source_attribute: :target_id,
destination_attribute: :id,
filter: expr(parent(target_type) == :formation)
has_one :member, Safari.Wiki.Member,
source_attribute: :target_id,
destination_attribute: :id,
filter: expr(parent(target_type) == :member)
end