Documentation
¶
Index ¶
Constants ¶
View Source
const ( CONFIG_FILE_NAME = "migdb.yaml" CONFIG_FILE_BASE = "migdb" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatabaseRepo ¶ added in v0.0.6
type DatabaseRepo interface {
CreateMigrationTableIfNotExists() error
GetLastAppliedMigrationFromDatabase() (*MigrationEntry, error)
ApplyMigration(migration *SqlMigration) error
GetMigrationEntries() (*[]MigrationEntry, error)
DeleteMigrationTable() error
}
type DatabaseType ¶ added in v0.1.1
type DatabaseType int
const ( DBpostgresql DatabaseType = iota + 1 DBsqlite3 DatabaseType = iota + 1 DBmysql DatabaseType = iota + 1 )
func MapDatabaseChoice ¶ added in v0.2.0
func MapDatabaseChoice(db string) DatabaseType
type FileSystemRepo ¶ added in v0.0.2
type FileSystemRepo interface {
RootFolder() string
Extention() string
MkAlldirIfnotExists(paths []string) error
CreateFilesInDirectories(directoryList []string, fileNames []string) error
GetFilesFromDirectory(directory string) ([]string, error)
LoadMigrationsFromFiles(MigrationType, []string) (*[]SqlMigration, error)
RemoveFilesFromDirectories(directoryList []string, fileNames []string) error
FillMigrationFile(MigrationType, string, string) error
}
type MigrationEntry ¶ added in v0.0.2
type MigrationEntry struct {
Name string
MigType MigrationType
Created time.Time
}
type MigrationType ¶ added in v0.1.1
type MigrationType string
const ( MIGRATION_TYPE_UP MigrationType = "up" MIGRATION_TYPE_DOWN MigrationType = "down" )
type MigratorConfig ¶ added in v0.0.2
type MigratorConfig struct {
Database int
Extention string
Migrator MigratorService
}
type MigratorService ¶ added in v0.0.2
type MigratorService interface {
// MigrateUp(0) will run all migrations
// MigrateUp(2) will run next 2 migrations
MigrateUp(int) error
// MigrateDown(0) will run all down migrations
// MigrateDown(2) will run next 2 migrations
MigrateDown(int) error
DeleteMigrationTable() error
GetMigrationEntries() (*[]MigrationEntry, error)
}
type SqlMigration ¶ added in v0.0.6
type SqlMigration struct {
Name string
Query string
Type MigrationType
}
Click to show internal directories.
Click to hide internal directories.