How to list Projects and Repositories that have been renamed or moved and their aliases in Bitbucket Data Center

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

This knowledge-base article provides queries for listing projects and repositories that have aliases.

Bitbucket 5.0 added the feature for historical aliasing of projects and repositories:

BSERV-3751 - Getting issue details... STATUS

With this feature, projects and repositories that have been renamed or moved can still be accessed using their original identifiers (project keys for projects and and repository slugs/names for repositories).

The original identifiers are referred to as "aliases".


Solution

Tables

Aliases are stored in the following database tables:

TableDescription
bb_repository_aliasA row is added to this table when a repository is renamed or moved between projects
bb_project_aliasA row is added to this table when a project key is changed

Sample queries

Repositories that have been renamed or moved

select r.id as repo_id, p.project_key, r.slug as repo_slug, bra.project_key as alias_project_key, bra.slug as alias_repo_slug
from repository r 
inner join project p on p.id=r.project_id
inner join bb_repository_alias bra on bra.repository_id=r.id; 

Projects whose keys have been changed

select p.id as project_id, p.project_key, bpa.project_key as alias_project_key
from project p 
inner join bb_project_alias bpa on bpa.project_id=p.id;





Last modified on Aug 21, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.