How to determine a foreign key in Mnesia

Is there an equivalent of this SQL statement in Mnesia?

alter table TABLE add foreign key (FIELD) references TABLE2 (FIELD2) 
+4
source share
2 answers

No, you need to do all this yourself in your mnesia transactions. Consistency is your responsibility.

Mnesia is somewhat deliberately simplified in these functions, so it’s easy to see the costs of performing requests / updates. Maintaining secondary indexes on tables is basically the only sugar you get.

+7
source

There is a library written by Ulf Wieger (formerly Erickson, now at Erlang Training And Consulting Ltd) called RDBMS that implements this a lot for you.

It is quite old, therefore YMMV.

+4
source

All Articles