Laravel-inspired database migrations for Go
Get running in 60 seconds
Chain methods elegantly with a Laravel-inspired syntax that feels natural and readable.
PostgreSQL, MySQL, and SQLite support using standard database/sql package.
Full rollback functionality with batch tracking for safe schema changes.
Simple configuration with .env files - no complex connection strings needed.
Full foreign key support with cascading actions and relationship management.
Leverage Go's type system for compile-time safety and excellent IDE support.
No setup required! Automatically creates migration runner on first use.
Automatically formats migration names with create_ prefix and _table suffix.
Automatically handles MySQL reserved keywords like limit, order, and type.
Clean, expressive syntax for defining your schema
package migrations
import "github.com/ichtrojan/olympian"
func init() {
olympian.RegisterMigration(olympian.Migration{
Name: "create_users_table",
Up: func() error {
return olympian.Table("users").Create(func() {
olympian.Uuid("id").Primary()
olympian.String("email").Unique()
olympian.String("password")
olympian.Boolean("verified").Default(false)
olympian.Timestamps()
})
},
Down: func() error {
return olympian.Table("users").Drop()
},
})
}
olympian.Table("posts").Create(func() {
olympian.Uuid("id").Primary()
olympian.String("user_id")
olympian.String("title")
olympian.Text("content")
olympian.Foreign("user_id").
References("id").
On("users").
OnDelete("cascade")
olympian.Timestamps()
})
olympian.Table("users").Modify(func() {
olympian.Text("bio").Nullable()
olympian.String("avatar").Nullable()
olympian.Integer("age").After("name")
})
Powerful command-line interface for managing migrations
Run all pending migrations
Create a new migration file with smart naming (automatically adds create_ and _table)
Rollback the last batch of migrations
Show migration status
Rich set of column types for any schema
UUID primary keys
VARCHAR(255)
Long text content
Integer numbers
True/false values
Date and time
JSON/JSONB data
Precise decimals
olympian.String("email").Nullable()
olympian.Uuid("id").Primary()
olympian.String("username").Unique()
olympian.Boolean("active").Default(true)
olympian.Integer("age").After("name")
olympian.Integer("id").AutoIncrement()
Olympian brings the elegance of Laravel's migration system to Go. If you've ever wished for a more expressive way to manage database schemas in Go, Olympian is your answer.