mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
* move mattes migrations to migratex * changes format of migrations to migratex format * updates test runner to use new interface (double checked this with printlns, the tests go fully down and then up, and work on pg/mysql) * remove mattes/migrate * update tests from deps * update readme * fix other file extensions
27 lines
539 B
Go
27 lines
539 B
Go
package migrations
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/fnproject/fn/api/datastore/sql/migratex"
|
|
"github.com/jmoiron/sqlx"
|
|
)
|
|
|
|
func up2(ctx context.Context, tx *sqlx.Tx) error {
|
|
_, err := tx.ExecContext(ctx, "ALTER TABLE calls ADD stats text;")
|
|
return err
|
|
}
|
|
|
|
func down2(ctx context.Context, tx *sqlx.Tx) error {
|
|
_, err := tx.ExecContext(ctx, "ALTER TABLE calls DROP COLUMN stats;")
|
|
return err
|
|
}
|
|
|
|
func init() {
|
|
Migrations = append(Migrations, &migratex.MigFields{
|
|
VersionFunc: vfunc(2),
|
|
UpFunc: up2,
|
|
DownFunc: down2,
|
|
})
|
|
}
|