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
538 B
Go
27 lines
538 B
Go
package migrations
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/fnproject/fn/api/datastore/sql/migratex"
|
|
"github.com/jmoiron/sqlx"
|
|
)
|
|
|
|
func up7(ctx context.Context, tx *sqlx.Tx) error {
|
|
_, err := tx.ExecContext(ctx, "ALTER TABLE routes ADD cpus int;")
|
|
return err
|
|
}
|
|
|
|
func down7(ctx context.Context, tx *sqlx.Tx) error {
|
|
_, err := tx.ExecContext(ctx, "ALTER TABLE routes DROP COLUMN cpus;")
|
|
return err
|
|
}
|
|
|
|
func init() {
|
|
Migrations = append(Migrations, &migratex.MigFields{
|
|
VersionFunc: vfunc(7),
|
|
UpFunc: up7,
|
|
DownFunc: down7,
|
|
})
|
|
}
|