Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Migrator ¶
type Migrator struct { // MigrationsTable is name of the table that holds current migration version. // Each migration set requires a separate MigrationsTable. MigrationsTable string // Handle is the sql.DB handle used to execute migration statements Handle *sql.DB // Indicates if migration version should be force reset to latest on file in case of revert to lower version // Eg. DB has v3 set in MigrationsTable but latest version in MigrationsDir is v2 ShouldForceSetLowerVersion bool // Indicates if all migrations should be run ignoring the current version in MigrationsTable RunAlways bool }
Migrator is responsible for migrating postgres tables
func (*Migrator) MigrateFromTemplates ¶
MigrateFromTemplates migrates database with migration scripts provided by golang templates. Migration templates are read from all files in templatesDir and converted using provided context as template data. Directories inside templates directory are ignored.
Click to show internal directories.
Click to hide internal directories.