Skip to content

Commit 554c087

Browse files
committed
fix: remove manualStep count tracking
1 parent 7165fe3 commit 554c087

File tree

5 files changed

+18
-59
lines changed

5 files changed

+18
-59
lines changed

meteor/server/coreSystem/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async function initializeCoreSystem() {
8484
if (!isRunningInJest()) {
8585
// Check what migration has to provide:
8686
const migration = await prepareMigration(true)
87-
if (migration.migrationNeeded && migration.manualStepCount === 0 && migration.chunks.length <= 1) {
87+
if (migration.migrationNeeded && migration.chunks.length <= 1) {
8888
// Since we've determined that the migration can be done automatically, and we have a fresh system, just do the migration automatically:
8989
await runMigration(migration.chunks, migration.hash)
9090
}

meteor/server/migration/__tests__/migrations.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,8 @@ describe('Migrations', () => {
4747
migrationNeeded: true,
4848

4949
migration: {
50-
canDoAutomaticMigration: true,
51-
// manualInputs: [],
5250
hash: expect.stringContaining(''),
5351
automaticStepCount: expect.any(Number),
54-
manualStepCount: expect.any(Number),
5552
ignoredStepCount: expect.any(Number),
5653
partialMigration: true,
5754
// chunks: expect.any(Array)

meteor/server/migration/databaseMigration.ts

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ export interface PreparedMigration {
8787
steps: MigrationStepInternal[]
8888
migrationNeeded: boolean
8989
automaticStepCount: number
90-
manualStepCount: number
9190
ignoredStepCount: number
9291
partialMigration: boolean
9392
}
@@ -150,7 +149,6 @@ export async function prepareMigration(returnAllChunks?: boolean): Promise<Prepa
150149
})
151150

152151
let automaticStepCount = 0
153-
let manualStepCount = 0
154152
let ignoredStepCount = 0
155153

156154
let partialMigration = false
@@ -226,11 +224,8 @@ export async function prepareMigration(returnAllChunks?: boolean): Promise<Prepa
226224
for (const step of Object.values<MigrationStepInternal>(migrationSteps)) {
227225
stepsHash.push(step.id)
228226
step.chunk._steps.push(step.id)
229-
if (!step.canBeRunAutomatically) {
230-
manualStepCount++
231-
} else {
232-
automaticStepCount++
233-
}
227+
228+
automaticStepCount++
234229
}
235230

236231
// Only return the chunks which has steps in them:
@@ -251,7 +246,6 @@ export async function prepareMigration(returnAllChunks?: boolean): Promise<Prepa
251246
steps: steps,
252247
migrationNeeded: migrationNeeded,
253248
automaticStepCount: automaticStepCount,
254-
manualStepCount: manualStepCount,
255249
ignoredStepCount: ignoredStepCount,
256250
partialMigration: partialMigration,
257251
}
@@ -322,9 +316,7 @@ export async function runMigration(
322316
}
323317
}
324318

325-
logger.info(
326-
`Migration: ${migration.automaticStepCount} automatic and ${migration.manualStepCount} manual steps (${migration.ignoredStepCount} ignored).`
327-
)
319+
logger.info(`Migration: ${migration.automaticStepCount} steps (${migration.ignoredStepCount} ignored).`)
328320

329321
for (const step of migration.steps) {
330322
try {
@@ -367,12 +359,12 @@ export async function runMigration(
367359

368360
let migrationCompleted = false
369361

370-
if (migration.manualStepCount === 0 && !warningMessages.length) {
362+
if (!warningMessages.length) {
371363
// continue automatically with the next batch
372364
logger.info('Migration: Automatically continuing with next batch..')
373365
migration.partialMigration = false
374366
const s = await getMigrationStatus()
375-
if (s.migration.automaticStepCount > 0 || s.migration.manualStepCount > 0) {
367+
if (s.migration.automaticStepCount > 0) {
376368
try {
377369
const res = await runMigration(s.migration.chunks, s.migration.hash, false, chunksLeft - 1)
378370
if (res.migrationCompleted) {
@@ -426,13 +418,10 @@ export async function getMigrationStatus(): Promise<GetMigrationStatusResult> {
426418
migrationNeeded: migration.migrationNeeded,
427419

428420
migration: {
429-
canDoAutomaticMigration: migration.manualStepCount === 0,
430-
431421
hash: migration.hash,
432422
chunks: migration.chunks,
433423

434424
automaticStepCount: migration.automaticStepCount,
435-
manualStepCount: migration.manualStepCount,
436425
ignoredStepCount: migration.ignoredStepCount,
437426
partialMigration: migration.partialMigration,
438427
},

packages/meteor-lib/src/api/migration.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,8 @@ export interface GetMigrationStatusResult {
101101
migrationNeeded: boolean
102102

103103
migration: {
104-
canDoAutomaticMigration: boolean
105104
hash: string
106105
automaticStepCount: number
107-
manualStepCount: number
108106
ignoredStepCount: number
109107
partialMigration: boolean
110108
chunks: Array<MigrationChunk>

packages/webui/src/client/ui/Settings/Migration.tsx

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ interface IState {
2424
showAllSteps: boolean
2525

2626
migration?: {
27-
canDoAutomaticMigration: boolean
2827
hash: string
2928
chunks: Array<MigrationChunk>
3029
automaticStepCount: number
3130
ignoredStepCount: number
32-
manualStepCount: number
3331
partialMigration: boolean
3432
}
3533
warnings: Array<string>
@@ -219,7 +217,7 @@ export const MigrationView = translateWithTracker<IProps, IState, ITrackedProps>
219217

220218
<p>
221219
{t(
222-
`This migration consists of ${this.state.migration.automaticStepCount} automatic steps and ${this.state.migration.manualStepCount} manual steps (${this.state.migration.ignoredStepCount} steps are ignored).`
220+
`This migration consists of ${this.state.migration.automaticStepCount} steps (${this.state.migration.ignoredStepCount} steps are ignored).`
223221
)}
224222
</p>
225223

@@ -264,40 +262,17 @@ export const MigrationView = translateWithTracker<IProps, IState, ITrackedProps>
264262
)}
265263
</p>
266264
) : null}
267-
{this.state.migration.canDoAutomaticMigration ? (
268-
<div>
269-
<p>{t('The migration can be completed automatically.')}</p>
270-
<Button
271-
onClick={() => {
272-
this.runMigration()
273-
}}
274-
>
275-
<FontAwesomeIcon icon={faDatabase} className="me-2" />
276-
<span>{t('Run automatic migration procedure')}</span>
277-
</Button>
278-
</div>
279-
) : (
280-
<div>
281-
<p className="my-2">
282-
{t('The migration procedure needs some help from you in order to complete, see below:')}
283-
</p>
284-
<button
285-
className="btn btn-primary mt-4"
286-
onClick={() => {
287-
doModalDialog({
288-
title: t('Double-check Values'),
289-
message: t('Are you sure the values you have entered are correct?'),
290-
onAccept: () => {
291-
this.runMigration()
292-
},
293-
})
294-
}}
295-
>
296-
<FontAwesomeIcon icon={faClipboardCheck} className="me-2" />
297-
<span>{t('Run Migration Procedure')}</span>
298-
</button>
299-
</div>
300-
)}
265+
<div>
266+
<p>{t('The migration can be completed automatically.')}</p>
267+
<Button
268+
onClick={() => {
269+
this.runMigration()
270+
}}
271+
>
272+
<FontAwesomeIcon icon={faDatabase} className="me-2" />
273+
<span>{t('Run automatic migration procedure')}</span>
274+
</Button>
275+
</div>
301276

302277
{this.state.warnings.length ? (
303278
<div>

0 commit comments

Comments
 (0)