{"id":2387,"date":"2015-10-13T14:24:15","date_gmt":"2015-10-13T14:24:15","guid":{"rendered":"https:\/\/twproject.com\/support\/using-twproject\/connections\/database-structure\/"},"modified":"2021-10-04T10:45:05","modified_gmt":"2021-10-04T10:45:05","slug":"database-structure","status":"publish","type":"page","link":"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/","title":{"rendered":"Database structure"},"content":{"rendered":"<p>Here we outline Twproject\u2019s database relational structure. We assume familiarity with relational concepts. For readability and in order to give the essential information, we don\u2019t cover complete schemas. E.g. relationship to the area and operator table are usually removed.<\/p>\n<h2>Basic project data and dates<\/h2>\n<p>Basic project data is in the twk_task table. Notice the \u201cparent\u201d column that is a foreign key that points to the same table, and determines the project position in the tree. The recursive values of the parents are also stored (denormalized) in the \u201cancestorids\u201d field for performance reasons. The twk_taskrelation contains one record for each parent-descendant couple, plus the self-self relation.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5128\" src=\"https:\/\/twproject.com\/support\/wp-content\/uploads\/2018\/01\/task_relations.png\" alt=\"\" width=\"725\" height=\"774\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>Project and assignments<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5129\" src=\"https:\/\/twproject.com\/support\/wp-content\/uploads\/2018\/01\/assignments_relations.png\" alt=\"\" width=\"908\" height=\"835\" \/><\/p>\n<p>The most important relation connecting projects with people is the assignment. The twk_assignment table is a relational table that connects projects to resources (people) and roles. Also all worklog inserted in Twproject is \u201con\u201d an assignment. So to query the worklog on a project, you will have to join to assignments and from there join to worklogs. The twk_assignment_data_hist contains the hisotory of assignment values changes.<\/p>\n<h2>ToDos<\/h2>\n<p>ToDos are stored in twk_issue table. Every ToDo is in relation with a task and eventually assigned to a resource.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5130\" src=\"https:\/\/twproject.com\/support\/wp-content\/uploads\/2018\/01\/todo-relations.png\" alt=\"\" width=\"782\" height=\"863\" \/><\/p>\n<p>ToDos related worklogs will refer to an assignment and with the ToDo itself.<br \/>\nNotice that there is a de-normalized reference to worklogs, and the table issue_history where the history of changes to the ToDo is kept.<\/p>\n<h2>Agenda<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"\" src=\"https:\/\/twproject.com\/support\/wp-content\/uploads\/2014\/02\/clip_image010.png\" alt=\"\" width=\"642\" height=\"565\" border=\"0\" \/><\/p>\n<p>Every item in the agenda has a schedule and a set of participants. The schedule is directly joined, the participants are collected by joining through the twk_agenda_tar. If eventually the agenda event is also a meeting, there is a foreign key to the twk_meeting table.<\/p>\n<h2>Resource<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"\" src=\"https:\/\/twproject.com\/support\/wp-content\/uploads\/2014\/02\/clip_image0121.png\" alt=\"\" width=\"642\" height=\"714\" border=\"0\" \/><\/p>\n<p>Resources are obviously involved in most Twproject tables; here we just show the direct dependencies on this table. Notice that the resource basic data (such as \u201ce-mail\u201d) is kept in a join though twk_res_ad to olpl_anagraphicaldata.<\/p>\n<h2>What is the logged user?<\/h2>\n<p>Twproject logged users are \u201cdouble\u201d entities: they are \u201cresources\u201d, so that assignments can be done on them, and users of the system, so they can log in.<\/p>\n<p>So a user that logs in is a record in the olpl_operator table, that is in 1-to-1 relationship with a record in the twk_resources table.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"margin-left: 0px; display: inline; margin-right: 0px; border-width: 0px;\" title=\"\" src=\"https:\/\/twproject.com\/support\/wp-content\/uploads\/2014\/02\/clip_image013.png\" alt=\"\" width=\"189\" height=\"116\" align=\"right\" border=\"0\" hspace=\"12\" \/><\/p>\n<p>The resource record id is shown in the web interface in the resource editor general tab;<\/p>\n<p>The operator record id in the security\/login tab.<\/p>\n<p>In almost all cases what you need to filter records is the resource record id: on ToDo, worklogs, assignments.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"margin-left: 0px; display: inline; margin-right: 0px; border-width: 0px;\" title=\"\" src=\"https:\/\/twproject.com\/support\/wp-content\/uploads\/2014\/02\/clip_image0151.jpg\" alt=\"\" width=\"178\" height=\"90\" align=\"right\" border=\"0\" hspace=\"12\" \/><\/p>\n<p>An exception is the subscription engine.<\/p>\n<h2>Filter by area?<\/h2>\n<p>Filtering by area is trivial, as most objects have an area or areax column for which you can filter.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here we outline Twproject\u2019s database relational structure. We assume familiarity with relational concepts. For readability and in order to give the essential information, we don\u2019t cover complete schemas. E.g. relationship to the area and operator table are usually removed. Basic project data and dates Basic project data is in the twk_task table. Notice the \u201cparent\u201d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2383,"menu_order":28,"comment_status":"closed","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-2387","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Database structure | Twproject support<\/title>\n<meta name=\"description\" content=\"Here we outline Twproject\u2019s database relational structure. We assume familiarity with relational concepts. For readability and in order to give the\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Database structure | Twproject support\" \/>\n<meta property=\"og:description\" content=\"Here we outline Twproject\u2019s database relational structure. We assume familiarity with relational concepts. For readability and in order to give the\" \/>\n<meta property=\"og:url\" content=\"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/\" \/>\n<meta property=\"og:site_name\" content=\"Twproject support\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/twproject\" \/>\n<meta property=\"article:modified_time\" content=\"2021-10-04T10:45:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/twproject.com\/support\/wp-content\/uploads\/2018\/01\/task_relations.png\" \/>\n\t<meta property=\"og:image:width\" content=\"725\" \/>\n\t<meta property=\"og:image:height\" content=\"774\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/\",\"url\":\"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/\",\"name\":\"Database structure | Twproject support\",\"isPartOf\":{\"@id\":\"https:\/\/twproject.com\/support\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/twproject.com\/support\/wp-content\/uploads\/2018\/01\/task_relations.png\",\"datePublished\":\"2015-10-13T14:24:15+00:00\",\"dateModified\":\"2021-10-04T10:45:05+00:00\",\"description\":\"Here we outline Twproject\u2019s database relational structure. We assume familiarity with relational concepts. For readability and in order to give the\",\"breadcrumb\":{\"@id\":\"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/#primaryimage\",\"url\":\"https:\/\/twproject.com\/support\/wp-content\/uploads\/2018\/01\/task_relations.png\",\"contentUrl\":\"https:\/\/twproject.com\/support\/wp-content\/uploads\/2018\/01\/task_relations.png\",\"width\":725,\"height\":774},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/twproject.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Advanced usage\",\"item\":\"https:\/\/twproject.com\/support\/twproject-advanced-usage\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Import \/ Export\",\"item\":\"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Database structure\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/twproject.com\/support\/#website\",\"url\":\"https:\/\/twproject.com\/support\/\",\"name\":\"Twproject support\",\"description\":\"Twproject documentation online\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/twproject.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Database structure | Twproject support","description":"Here we outline Twproject\u2019s database relational structure. We assume familiarity with relational concepts. For readability and in order to give the","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/","og_locale":"en_US","og_type":"article","og_title":"Database structure | Twproject support","og_description":"Here we outline Twproject\u2019s database relational structure. We assume familiarity with relational concepts. For readability and in order to give the","og_url":"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/","og_site_name":"Twproject support","article_publisher":"https:\/\/www.facebook.com\/twproject","article_modified_time":"2021-10-04T10:45:05+00:00","og_image":[{"width":725,"height":774,"url":"https:\/\/twproject.com\/support\/wp-content\/uploads\/2018\/01\/task_relations.png","type":"image\/png"}],"twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/","url":"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/","name":"Database structure | Twproject support","isPartOf":{"@id":"https:\/\/twproject.com\/support\/#website"},"primaryImageOfPage":{"@id":"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/#primaryimage"},"image":{"@id":"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/#primaryimage"},"thumbnailUrl":"https:\/\/twproject.com\/support\/wp-content\/uploads\/2018\/01\/task_relations.png","datePublished":"2015-10-13T14:24:15+00:00","dateModified":"2021-10-04T10:45:05+00:00","description":"Here we outline Twproject\u2019s database relational structure. We assume familiarity with relational concepts. For readability and in order to give the","breadcrumb":{"@id":"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/#primaryimage","url":"https:\/\/twproject.com\/support\/wp-content\/uploads\/2018\/01\/task_relations.png","contentUrl":"https:\/\/twproject.com\/support\/wp-content\/uploads\/2018\/01\/task_relations.png","width":725,"height":774},{"@type":"BreadcrumbList","@id":"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/database-structure\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/twproject.com\/support\/"},{"@type":"ListItem","position":2,"name":"Advanced usage","item":"https:\/\/twproject.com\/support\/twproject-advanced-usage\/"},{"@type":"ListItem","position":3,"name":"Import \/ Export","item":"https:\/\/twproject.com\/support\/twproject-advanced-usage\/connections\/"},{"@type":"ListItem","position":4,"name":"Database structure"}]},{"@type":"WebSite","@id":"https:\/\/twproject.com\/support\/#website","url":"https:\/\/twproject.com\/support\/","name":"Twproject support","description":"Twproject documentation online","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/twproject.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/twproject.com\/support\/wp-json\/wp\/v2\/pages\/2387","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/twproject.com\/support\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/twproject.com\/support\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/twproject.com\/support\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/twproject.com\/support\/wp-json\/wp\/v2\/comments?post=2387"}],"version-history":[{"count":0,"href":"https:\/\/twproject.com\/support\/wp-json\/wp\/v2\/pages\/2387\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/twproject.com\/support\/wp-json\/wp\/v2\/pages\/2383"}],"wp:attachment":[{"href":"https:\/\/twproject.com\/support\/wp-json\/wp\/v2\/media?parent=2387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}