
Adds four foreign keys: - stopwatch -- issue_id -> issue, user_id -> user - tracked_time -- issue_id -> issue, user_id -> user The majority of work encompassed in this PR is updating testing and support infrastructure to support foreign keys: - `models/db/foreign_keys.go` adds new capabilities to sort registered tables into the right insertion order to avoid violating foreign keys - `RecreateTables`, used by migration testing and the `doctor recreate-table` CLI, has been updated to support tables with foreign keys; new restrictions require that FK-related tables be rebuilt at the same time - test fixture data is inserted in foreign-key order, and deleted in the reverse An upgrade to xorm v1.3.9-forgejo.2 is incorporated in this PR, as two unexpected behaviors in the foreign key schema management were discovered during development of the updated `RecreateTables` routine. Work in this PR is laid out to be reviewed easier commit-by-commit. ## Checklist The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org). ### Tests - I added test coverage for Go changes... - [x] in their respective `*_test.go` for unit tests. - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server. - I added test coverage for JavaScript changes... - [ ] in `web_src/js/*.test.js` if it can be unit tested. - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)). ### Documentation - [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change. - [x] I did not document these changes and I do not expect someone else to do it. ### Release notes - [ ] I do not want this change to show in the release notes. - [ ] I want the title to show in the release notes with a link to this pull request. - [x] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9373 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net> Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
70 lines
816 B
YAML
70 lines
816 B
YAML
-
|
|
id: 1
|
|
user_id: 1
|
|
issue_id: 1
|
|
time: 400
|
|
created_unix: 946684800
|
|
deleted: false
|
|
|
|
-
|
|
id: 2
|
|
user_id: 2
|
|
issue_id: 2
|
|
time: 3661
|
|
created_unix: 946684801
|
|
deleted: false
|
|
|
|
-
|
|
id: 3
|
|
user_id: 2
|
|
issue_id: 2
|
|
time: 1
|
|
created_unix: 946684802
|
|
deleted: false
|
|
|
|
-
|
|
id: 4
|
|
issue_id: 4
|
|
time: 1
|
|
created_unix: 946684803
|
|
deleted: false
|
|
|
|
-
|
|
id: 5
|
|
user_id: 2
|
|
issue_id: 5
|
|
time: 1
|
|
created_unix: 946684804
|
|
deleted: false
|
|
|
|
-
|
|
id: 6
|
|
user_id: 1
|
|
issue_id: 2
|
|
time: 20
|
|
created_unix: 946684812
|
|
deleted: false
|
|
|
|
-
|
|
id: 7
|
|
user_id: 2
|
|
issue_id: 4
|
|
time: 3
|
|
created_unix: 946684813
|
|
deleted: false
|
|
|
|
-
|
|
id: 8
|
|
user_id: 1
|
|
issue_id: 4
|
|
time: 71
|
|
created_unix: 947688814
|
|
deleted: false
|
|
|
|
-
|
|
id: 9
|
|
user_id: 2
|
|
issue_id: 2
|
|
time: 100000
|
|
created_unix: 947688815
|
|
deleted: true
|