[CORL-649] Migrations (#2597)

* feat: added migration framework

* chore: added premod user status migration

* feat: enhanced error handling of migrations

* fix: added missing argument from abstract method

* fix: another templating blunder

* fix: removed debug code

* feat: enhanced migration tracking

* fix: remove skipping migrations

* feat: moved indexing to migration system

* fix: linting
This commit is contained in:
Wyatt Johnson
2019-10-01 16:00:27 +00:00
committed by GitHub
parent b3b26bd9f3
commit c045f52daa
40 changed files with 1038 additions and 469 deletions
@@ -31,8 +31,7 @@ export const UserStatus: Required<
}
// If they are set to mandatory premod, then mark it.
// FIXME: (wyattjoh) once migration has been performed, remove check
if (consolidatedStatus.premod && consolidatedStatus.premod.active) {
if (consolidatedStatus.premod.active) {
statuses.push(GQLUSER_STATUS.PREMOD);
}
@@ -55,17 +54,8 @@ export const UserStatus: Required<
...user.consolidateUserSuspensionStatus(suspension),
userID,
}),
// FIXME: (wyattjoh) once migration has been performed, return PremodStatusInput only
premod: ({ premod, userID }): PremodStatusInput | null => {
const status = user.consolidateUserPremodStatus(premod);
// FIXME: (wyattjoh) once migration has been performed, remove check
if (!status) {
return null;
}
return {
...status,
userID,
};
},
premod: ({ premod, userID }): PremodStatusInput => ({
...user.consolidateUserPremodStatus(premod),
userID,
}),
};
@@ -1541,10 +1541,8 @@ type UserStatus {
"""
premod stores the user premod status as well as the history of changes.
FIXME: (wyattjoh) once migration has been performed, make non-nullable
"""
premod: PremodStatus @auth(roles: [ADMIN, MODERATOR])
premod: PremodStatus! @auth(roles: [ADMIN, MODERATOR])
}
"""