20 lines
402 B
Go
20 lines
402 B
Go
package migrations
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/uptrace/bun"
|
|
)
|
|
|
|
func init() {
|
|
Migrations.MustRegister(func(ctx context.Context, db *bun.DB) error {
|
|
fmt.Print(" [up migration] ")
|
|
_, err := db.Exec(`ALTER TABLE blogs ALTER COLUMN blog_id SET DEFAULT gen_random_uuid()`)
|
|
return err
|
|
}, func(ctx context.Context, db *bun.DB) error {
|
|
fmt.Print(" [down migration] ")
|
|
return nil
|
|
})
|
|
}
|