Is there an equivalent to this SQL statement in Mnesia?
alter table TABLE
add foreign key (FIELD)
references TABLE2 (FIELD2)
No, you have to do all these things yourself in your mnesia transactions. Consistency is your responsibility.
Mnesia is somewhat intentionally simplistic in these features, so it is easy to see the costs in performing queries/updates. The support for secondary indexes on tables is basically the only sugar you get.
There is a library written by Ulf Wiger (formerly of Ericcson, now at Erlang Training And Consulting Ltd) called RDBMS which implements a lot of this for you.
It is quite old so YMMV.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With