refactor: group migration graph logic
This commit is contained in:
parent
e68ded1b3c
commit
88db84cac4
2 changed files with 9 additions and 9 deletions
|
@ -5,6 +5,15 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type MigrationGraph struct {
|
||||||
|
// Reference to the root of the graph.
|
||||||
|
Root *Migration
|
||||||
|
// Name to struct mapping of all migrations part of the graph.
|
||||||
|
Migrations map[string]Migration
|
||||||
|
// Mapping of all migrations to their parent, if any.
|
||||||
|
parentage map[string]*Migration
|
||||||
|
}
|
||||||
|
|
||||||
func NewMigrationGraph() MigrationGraph {
|
func NewMigrationGraph() MigrationGraph {
|
||||||
return MigrationGraph{Migrations: map[string]Migration{}, parentage: map[string]*Migration{}}
|
return MigrationGraph{Migrations: map[string]Migration{}, parentage: map[string]*Migration{}}
|
||||||
}
|
}
|
|
@ -11,15 +11,6 @@ type Migration struct {
|
||||||
Run bool
|
Run bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type MigrationGraph struct {
|
|
||||||
// Reference to the root of the graph.
|
|
||||||
Root *Migration
|
|
||||||
// Name to struct mapping of all migrations part of the graph.
|
|
||||||
Migrations map[string]Migration
|
|
||||||
// Mapping of all migrations to their parent, if any.
|
|
||||||
parentage map[string]*Migration
|
|
||||||
}
|
|
||||||
|
|
||||||
type DB interface {
|
type DB interface {
|
||||||
Execute(sql string) error
|
Execute(sql string) error
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue