From 88db84cac427cf96e785cb264c7702b267837327 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Thu, 11 Jul 2024 20:07:12 -0400 Subject: [PATCH] refactor: group migration graph logic --- MigrationMap.go => migration_graph.go | 9 +++++++++ models.go | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) rename MigrationMap.go => migration_graph.go (85%) diff --git a/MigrationMap.go b/migration_graph.go similarity index 85% rename from MigrationMap.go rename to migration_graph.go index fab309f..688459e 100644 --- a/MigrationMap.go +++ b/migration_graph.go @@ -5,6 +5,15 @@ import ( "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 { return MigrationGraph{Migrations: map[string]Migration{}, parentage: map[string]*Migration{}} } diff --git a/models.go b/models.go index 16489ec..dbe86a8 100644 --- a/models.go +++ b/models.go @@ -11,15 +11,6 @@ type Migration struct { 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 { Execute(sql string) error }