Skip to content
Snippets Groups Projects
Commit d950fdde authored by Aleksandr Lyapunov's avatar Aleksandr Lyapunov Committed by Aleksandr Lyapunov
Browse files

box: implement field foreign keys

Foreign key is a special type of constraint that makes a relation
between spaces. When declared in some space, each tuple in that
space refers to some tuple in another, foreign space. Reference is
defined in foreign key definition as a correspondence of field of
that spaces, local and remote.

Foreign key preserves that reference between tuples and consists
of two checks:
1. When a tuple is added to space with foreign space constraint,
it must be checked that there is a corresponding tuple in foreign
space, with the same values in fields according to foreign key
definitiion.
2. When a tuple is deleted from space that is a foreign space for
some other space, it must be checked that no tuple references the
deleted one.

This commit introduces field foreign keys that link spaces by
just one field. They are declared in tuple format in one of the
following forms:
 space:format{..,{name=.., foreign_key=<fkey>},..}
 space:format{..,{name=.., foreign_key={<name>=<fkey>}},..}
Where fkey has a form of a table:
 {space=<foreign space id/name>, field=<foreign field id/name>}

NO_DOC=see later commits
NO_CHANGELOG=see later commits
parent b00a4579
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment