Content
You are here:
Database schema does not contain relationships?
Added by Hanxue Lee about 7 years ago
I would like to contribute to OpenProject and currently looking at the source code. When I look at the database, I do not see any relationships between tables.
Specifically, when I look at the ActiveRecords migration script as well as the generated Postgresql database schema, there is no relationship defined. See my Postgresql database dump
https://gist.github.com/hanxue/e92dc71e66b3e43cabfeae2e723921d2
Am I missing anything from https://www.openproject.org/development/setting-up-development-environment/ ?
Database migration runs successfully
@ ./bin/rake db:migrate db:seed db:test:prepare@
And I can run OpenProject locally without any problems
$ gem install foreman $ foreman start -f Procfile.dev
Replies (1)
Glad that you are interested in supporting OpenProject development. Every bit of help is appreciated.
The relationships between the objects is modelled less strictly in the database. There are hardly any foreign key constraints and generally speaking, very few constraints on the db level at all. From the top of my head I’d say that apart from constraints enforced by uniq indices there do not exist any. So while there are columns that represent references to entries in a different table (e.g.
author_id
in thework_packages
table which references entries in theusers
table) those references are not enforced by database means.This is not ideal but as of now has not troubled us much as the relationships are modelled in the rails application via active record associations. The OpenProject application is the only application accessing the db and as long as that is the case we will get away with relying on the the framework.
And as the application seems to be working ok, everything should be good for you to start :)