Skip to content

Commit c97b589

Browse files
committed
feat: Add debug logging for migration lock file operations and storage root
1 parent 3b3f789 commit c97b589

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

apps/api/src/migrations/migrations.service.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ export class MigrationsService implements OnModuleInit {
4343
) {
4444
const storageRoot = this.config.get<string>('factorydrive.options.disks.local.config.root', '/tmp')
4545
this.lockLocation = posix.join(storageRoot, 'migrations.lock')
46+
this.logger.debug(`Migration lock file location: ${this.lockLocation}`)
47+
this.logger.debug(`Storage root: ${storageRoot}`)
48+
this.logger.debug(`Process CWD: ${process.cwd()}`)
4649
}
4750

4851
/**
@@ -239,8 +242,10 @@ export class MigrationsService implements OnModuleInit {
239242
try {
240243
// Ensure the directory exists before writing the file
241244
const lockDir = dirname(this.lockLocation)
245+
this.logger.debug(`Creating directory: ${lockDir}`)
242246
await mkdir(lockDir, { recursive: true })
243247

248+
this.logger.debug(`Writing migration lock file to: ${this.lockLocation}`)
244249
await writeFile(this.lockLocation, migrationTimestamp)
245250
await this.mongo.collection('migrations').insertOne({
246251
timestamp: parseInt(migrationTimestamp),
@@ -249,6 +254,8 @@ export class MigrationsService implements OnModuleInit {
249254
this.logger.log(chalk.blue(`Migration ${chalk.bold('<' + migrationKey + '>')} done.`))
250255
} catch (e) {
251256
this.logger.error(chalk.red(`Error while updating migration lock file !`))
257+
this.logger.error(`Lock file path: ${this.lockLocation}`)
258+
this.logger.error(`Lock file directory: ${dirname(this.lockLocation)}`)
252259
this.logger.error(e)
253260

254261
throw new Error('Error while updating migration lock file !')

0 commit comments

Comments
 (0)