Starting in v0.10.0, DevLake provides a lightweight migration tool for executing migration scripts. Both framework itself and plugins define their migration scripts in their own migration folder. The migration scripts are written with gorm in Golang to support different SQL dialects.
Migration script describes how to do database migration. They implement the Script
interface. When DevLake starts, scripts register themselves to the framework by invoking the Register
function
type Script interface {
Up(ctx context.Context, db *gorm.DB) error
Version() uint64
Name() string
}
migration_history
The table tracks migration scripts execution and schemas changes. From which, DevLake could figure out the current state of database schemas.
migration_history
table, calculate all the migration scripts need to be executed.migration_history
table.