woodpecker/server/store/datastore/migration
qwerty287 52d3652f2e
Fetch repositories with remote ID if possible (#1078)
Use IDs of the forge to fetch repositories instead of their names and owner names. This improves handling of renamed and transferred repos.

TODO

- [ ] try to support as many forges as possible
    - [x] Gogs (no API)
    - [ ] Bitbucket Server
    - [x] Coding (no API?)
- [x] update repo every time it is fetched or received from the forge
- [x] if repo remote IDs are not available, use owner / name to get it
- [x] handle redirections (redirect a renamed repo to its new path)
- [x] ~~pull all repos once during migration to update ID (?)~~ issue fixed by on-demand loading of remote IDs
- [x] handle redirections in web UI
- [ ] improve handling of hooks after a repo was renamed (currently it checks for a redirection to the repo)
- [x] tests
- [x] `UNIQUE` constraint for remote IDs after migration shouldn't work (all repos have an empty string as remote ID)

close #854
close #648 partial
close https://codeberg.org/Codeberg-CI/feedback/issues/46

Possible follow-up PRs
- apply the same scheme on everything fetched from the remote (currently only users)

Co-authored-by: 6543 <6543@obermui.de>
2022-09-05 17:08:51 +02:00
..
testfiles Add tests framework for storage migration (#630) 2021-12-20 16:15:21 +01:00
000_legacy_to_xorm.go Let non required migration tasks fail and continue (#729) 2022-01-31 15:50:10 +01:00
001_repos_drop_fallback.go Migrate to Xorm (#474) 2021-11-13 20:18:06 +01:00
002_repos_drop_allow_deploys_allow_tags.go Migrate to Xorm (#474) 2021-11-13 20:18:06 +01:00
003_fix_pr_secret_event_name.go Nits Collected over last month (#595) 2021-12-11 13:15:04 +01:00
004_repos_drop_repo_counter.go Calculate build number on creation (#615) 2021-12-18 20:37:51 +01:00
005_drop_senders.go Remove senders model (#923) 2022-05-17 21:27:44 +02:00
006_log_data_type.go Update type of 'log_data' from blob to longblob (#1050) 2022-07-29 14:57:18 +02:00
007_secrets_add_user.go Fix migration number (#1134) 2022-08-27 23:58:52 +02:00
common.go Add global and organization secrets (#1027) 2022-08-14 13:48:53 +02:00
common_test.go fix sqlite migration on column drop of uncommon schemas (#629) 2021-12-20 09:59:27 +01:00
migration.go Fetch repositories with remote ID if possible (#1078) 2022-09-05 17:08:51 +02:00
migration_test.go Dedup code and migrate away from deprecated funcs (#1141) 2022-08-30 01:14:07 +02:00