Skip to content

Commit d99e91a

Browse files
Fix database backward migration
1 parent 33362be commit d99e91a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/db/migrate.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -710,9 +710,15 @@ pub fn migrate(version: Option<Version>, conn: &mut Client) -> CratesfyiResult<(
710710
FROM repositories WHERE repositories.host = 'github.com';
711711
712712
UPDATE releases
713-
SET github_repo = repositories.host_id
714-
FROM repositories
715-
WHERE repositories.host_id = releases.github_repo AND releases.repository_id IS NOT NULL AND repositories.host = 'github.com';
713+
SET github_repo = (
714+
SELECT host_id
715+
FROM repositories
716+
WHERE
717+
repositories.host = 'github.com' AND
718+
repositories.id = releases.repository_id
719+
)
720+
WHERE
721+
repository_id IS NOT NULL;
716722
717723
DROP INDEX releases_github_repo_idx;
718724
DROP INDEX github_repos_stars_idx;

0 commit comments

Comments
 (0)