Extend
Through the extends
property we can extend the configuration in the schema. \
Entities, mappings and mapping entities can be extended.
Extend Entity
In this scheme we can see how to extend entities. \ In this case, the Countries and States entities are extended from the abstract entity Positions \ It is not mandatory that the entity be abstract to be able to use it as a basis to extend
domain:
entities:
- name: Positions
abstract: true
properties:
- name: latitude
length: 16
- name: longitude
length: 16
- name: Countries
extends: Positions
primaryKey: ["iso3"]
uniqueKey: ["name"]
properties:
- name: name
required: true
- name: iso3
length: 3
required: true
relations:
- name: states
type: manyToOne
composite: true
from: iso3
entity: States
to: countryCode
- name: States
extends: Positions
primaryKey: ["id"]
uniqueKey: ["countryCode", "name"]
properties:
- name: id
type: integer
required: true
- name: name
required: true
- name: countryCode
required: true
length: 3
relations:
- name: country
from: countryCode
entity: Countries
to: iso3
infrastructure:
sources:
- name: source1
dialect: MySQL
connection:
host: localhost
port: 3306
user: test
password: test
database: test