Ability to extend the sql-migrate#Migration
Open
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 3.4k
- Forks
- 292
- PR merge metrics
- No merged PRs in 30d
Description
Currently the https://godoc.org/github.com/rubenv/sql-migrate#Migration has the Up, Down []string which I guess will be read and run by migrate.Exec.
It would be nice if the Migration is an interface then we can do some update that need more than SQL script. For example:
type ComplexPwdGenMigration {
DB
}
func (m *ComplexMigration) Up() []string {
// then something like:
// people := m.DB.GetAll()
// for each person in fo person.password = veryComplexPasswordGenerate(person.id) + m.DB.Save(person)
return nil
}
// and implement the rest method of
migrations := &MixMigrationSource{
Migrations: []Migrator{
&migrate.Migration{
Id: "123",
Up: []string{"CREATE TABLE people (id int, password var)"},
Down: []string{"DROP TABLE people"},
},
&ComplexPwdGenMigration,
&AnotherComplexProcessMigration,
&migrate.Migration{
Id: "123",
Up: []string{"...."},
Down: []string{"....."},
},
},
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Migration, migrate.Exec, MixMigrationSource, and Migrator to understand the current SQL-only contract. Compare how existing migrations are represented and executed, then define and verify support for custom migration work alongside SQL Up and Down operations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, sql
- Domain
- database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100