Content
Updated by Sebastian Fiedlschuster over 1 year ago
In order to perform historic queries on work packages (https://community.openproject.org/work\_packages/26448), as a first step, we migrate from querying on the work-packages table to querying the corresponding work-package-journals table without change of behaviour.
First experiments were to directly replace queries on the `WorkPackage` class by queries on the `WorkPackageJournal` class.
A call-stack visualization shows where queries need to be replaced in this process: [https://github.com/fiedl/openproject/issues/1](https://github.com/fiedl/openproject/issues/1)
After these first experiments, I've pursued a more generic approach where a special kind of active-record relation is used to modify existing queries to perform their sql queries upon the historic data:
* [https://community.openproject.org/projects/openproject/work\_packages/44945](https://community.openproject.org/projects/openproject/work_packages/44945/relations)
* [https://community.openproject.org/projects/openproject/work\_packages/44946](https://community.openproject.org/projects/openproject/work_packages/44946)
* [https://community.openproject.org/projects/openproject/work\_packages/44947](https://community.openproject.org/projects/openproject/work_packages/44947)
* [https://github.com/opf/openproject/pull/11243](https://github.com/opf/openproject/pull/11243)
First experiments were to directly replace queries on the `WorkPackage` class by queries on the `WorkPackageJournal` class.
A call-stack visualization shows where queries need to be replaced in this process: [https://github.com/fiedl/openproject/issues/1](https://github.com/fiedl/openproject/issues/1)
After these first experiments, I've pursued a more generic approach where a special kind of active-record relation is used to modify existing queries to perform their sql queries upon the historic data:
* [https://community.openproject.org/projects/openproject/work\_packages/44945](https://community.openproject.org/projects/openproject/work_packages/44945/relations)
* [https://community.openproject.org/projects/openproject/work\_packages/44946](https://community.openproject.org/projects/openproject/work_packages/44946)
* [https://community.openproject.org/projects/openproject/work\_packages/44947](https://community.openproject.org/projects/openproject/work_packages/44947)
* [https://github.com/opf/openproject/pull/11243](https://github.com/opf/openproject/pull/11243)