rubenv / rubenv/sql-migrate

Running status command after MemoryMigrationSource fails

Open
#29 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
3.4k
Forks
292
PR merge metrics
No merged PRs in 30d

Description

The failure is:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x10 pc=0x40b8b7]

goroutine 1 [running]:
panic(0x8b3bc0, 0xc820010160)
    /usr/local/go/src/runtime/panic.go:464 +0x3e6
main.(*StatusCommand).Run(0xe64ee8, 0xc82000a5d0, 0x0, 0x0, 0x9e0718)
    /home/tim/dev/go/src/github.com/rubenv/sql-migrate/sql-migrate/command_status.go:86 +0xb87
github.com/mitchellh/cli.(*CLI).Run(0xc8203ee000, 0xc820012510, 0x0, 0x0)
    /home/tim/dev/go/src/github.com/mitchellh/cli/cli.go:153 +0x56e
main.realMain(0xc820000180)
    /home/tim/dev/go/src/github.com/rubenv/sql-migrate/sql-migrate/main.go:39 +0x39e
main.main()
    /home/tim/dev/go/src/github.com/rubenv/sql-migrate/sql-migrate/main.go:11 +0x18

Perhaps since those records exist in the database (even though they doen't in the file system) we should just consider then as Migrated = true and add a new row?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in command_status.go at line 86 and trace how StatusCommand.Run handles records from MemoryMigrationSource that remain in the database but not the filesystem. Reproduce the status command failure and determine the expected treatment of those records; done means the command no longer panics and reports a consistent migration status.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.