Skip to content

Commit 8a7b3a3

Browse files
authored
chore: migrate maintainerMV to use repositories (#3812)
1 parent b114a04 commit 8a7b3a3

3 files changed

Lines changed: 25 additions & 0 deletions

File tree

backend/src/database/migrations/U1770038298__migrateMaintainerMVtoRepositories.sql

Whitespace-only changes.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
-- Migrate mv_maintainer_roles from githubRepos to public.repositories
2+
-- This must run before dropping the githubRepos table
3+
4+
DROP MATERIALIZED VIEW IF EXISTS mv_maintainer_roles;
5+
6+
CREATE MATERIALIZED VIEW mv_maintainer_roles AS
7+
SELECT
8+
mai.id,
9+
mei."memberId",
10+
r."segmentId",
11+
mai."createdAt" AS "dateStart",
12+
NULL as "dateEnd",
13+
r.url,
14+
CASE WHEN i.platform = 'github-nango' THEN 'github' ELSE i.platform END AS "repoType",
15+
mai.role
16+
FROM "maintainersInternal" mai
17+
JOIN "memberIdentities" mei ON mai."identityId" = mei.id
18+
JOIN public.repositories r ON mai."repoId" = r.id
19+
JOIN integrations i ON r."sourceIntegrationId" = i.id
20+
WHERE r."deletedAt" IS NULL;
21+
22+
CREATE UNIQUE INDEX IF NOT EXISTS mv_maintainer_roles_id ON mv_maintainer_roles (id);

services/libs/data-access-layer/src/maintainers/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { QueryExecutor } from '../queryExecutor'
22

33
export enum MaintainerRepoType {
44
GITHUB = 'github',
5+
GITLAB = 'gitlab',
6+
GIT = 'git',
7+
GERRIT = 'gerrit',
58
}
69

710
export interface Maintainer {

0 commit comments

Comments
 (0)