Documentation ¶
Index ¶
Constants ¶
const ( FlowNumLimit = 4095 // FFF StepNumLimit = 255 // FF )
limits
const DefaultDialect = "postgres"
const DefaultTrackingTable = "mig_applied_migrations"
Variables ¶
This section is empty.
Functions ¶
func MakeID ¶
MakeID creates a migration ID from a given flow and step num flowNum and stepNum are converted to hex and appended to the prefix the intention is for each file to be numbered by its flowNum 001, 002 etc. but allow it to add related migrations in the future with stepNums this way create table and future alter table statements can be together in the same file
if you want your ID's to be valid uuid's then simply remove the last 6 chars from a baseID to create your prefix, such as "46855208-d306-4da2-bd18-30f7bc" as the flowNum and stepNum will always result in 6 chars, 3 for each number
Types ¶
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func (Runner) WithDialect ¶
WithDialect allows you to use something other than the default "postgres"
func (Runner) WithLogger ¶
func (Runner) WithSchema ¶
WithSchema sets the schemaName that the migration table is created in if that schema does not already exist it will try to create it for you
func (Runner) WithTrackingTable ¶
WithTrackingTable can be used to change the table name that migrations are recorded in if you qualify the table name with the schema it will also set the schema so tblName = "migrations" will set the table name leaving schemaName unchanged and tblName = "foo.migrations" will set both schema=foo, tbl=migrations