Skip to content

Extension Approach 1 and 2, only allow to add to schema. #53

@nimish-mehta

Description

@nimish-mehta

Right now in extension approach 1 and 2 we can only add to existing schema via

add_to_schema do
  # schema declarations to add go here
end

and then we use it like this in models.

schema "source" do
  original fields & relations
  extensions
end

While this is simple, it does not allow us to remove/modify existing relations.

What we can try and do is use something like this in models:

extended_schema "source" do
  original fields & relations
end

and then provide two methods:

add_to_schema do
end

remove_from_schema do
end

using this we can rewrite the schema call.

see initial implementation here and diff

This could allow us to add/remove fields to schema, however we want to be sure before implementing this whether we want to include this feature as it may cause things to break if used with abandon, i.e. compile time pattern matching fails or essential fields used throughout the system being removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions