Skip to content

Commit

Permalink
more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed Nov 2, 2023
1 parent fcf8151 commit 537e2c3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/pds/src/migrate-script/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const runScript = async () => {
}))
const todo = await db
.selectFrom('status')
.where('status.phase', '=', 0)
.where('status.phase', '<', 7)
.where('failed', '!=', 1)
.selectAll()
.execute()
Expand Down Expand Up @@ -68,13 +68,15 @@ const migrateRepo = async (
status: Status,
adminToken: string,
) => {
console.log(`reserve (${status.did}, ${status.phase})`)
if (status.phase < TransferPhase.reservedKey) {
const signingKey = await reserveSigningKey(pds, status.did)
status.signingKey = signingKey
status.phase = TransferPhase.reservedKey
await updateStatus(db, status)
}

console.log(`import (${status.did}, ${status.phase})`)
if (status.phase < TransferPhase.initImport) {
const importedRev = await doImport(ctx, db, pds, status.did)
if (importedRev) {
Expand All @@ -84,13 +86,15 @@ const migrateRepo = async (
await updateStatus(db, status)
}

console.log(`transfer (${status.did}, ${status.phase})`)
if (status.phase < TransferPhase.transferred) {
const importedRev = await lockAndTransfer(ctx, db, pds, status)
status.importedRev = importedRev
status.phase = TransferPhase.transferred
await updateStatus(db, status)
}

console.log(`prefs (${status.did}, ${status.phase})`)
if (status.phase < TransferPhase.preferences) {
try {
await transferPreferences(ctx, pds, status.did)
Expand All @@ -105,6 +109,7 @@ const migrateRepo = async (
}
}

console.log(`takedowns (${status.did}, ${status.phase})`)
if (status.phase < TransferPhase.takedowns) {
await transferTakedowns(ctx, db, pds, status.did, adminToken)
status.phase = TransferPhase.completed
Expand Down

0 comments on commit 537e2c3

Please sign in to comment.