add constraint and index to tables as in DM

Ran on my machine without problems