views:

207

answers:

2

Is there an equivalent to this SQL statement in Mnesia?

alter table TABLE
add foreign key (FIELD)
references TABLE2 (FIELD2)
+7  A: 

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.

Christian
+4  A: 

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.

Gordon Guthrie