You've already forked go-clickhouse
mirror of
https://github.com/uptrace/go-clickhouse.git
synced 2025-07-15 01:04:19 +02:00
feat: initial commit
This commit is contained in:
18
example/migrations/migrations/20210505110026_foo.go
Normal file
18
example/migrations/migrations/20210505110026_foo.go
Normal file
@ -0,0 +1,18 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/uptrace/go-clickhouse/ch"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Migrations.MustRegister(func(ctx context.Context, db *ch.DB) error {
|
||||
fmt.Print(" [up migration] ")
|
||||
return nil
|
||||
}, func(ctx context.Context, db *ch.DB) error {
|
||||
fmt.Print(" [down migration] ")
|
||||
return nil
|
||||
})
|
||||
}
|
@ -0,0 +1 @@
|
||||
SELECT 'down migration'
|
@ -0,0 +1 @@
|
||||
SELECT 'up migration'
|
18
example/migrations/migrations/main.go
Normal file
18
example/migrations/migrations/main.go
Normal file
@ -0,0 +1,18 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"embed"
|
||||
|
||||
"github.com/uptrace/go-clickhouse/chmigrate"
|
||||
)
|
||||
|
||||
var Migrations = chmigrate.NewMigrations()
|
||||
|
||||
//go:embed *.sql
|
||||
var sqlMigrations embed.FS
|
||||
|
||||
func init() {
|
||||
if err := Migrations.Discover(sqlMigrations); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user