implement graph database migrate command

Summary: Pull Request resolved: https://github.com/facebookexternal/fbc/pull/1281

Reviewed By: a8m

Differential Revision: D16757606

fbshipit-source-id: 89ad3cdf7b9a7c9931ac8e2b20f127a1cc125d62
This commit is contained in:
Alex Snast
2019-08-11 08:28:19 -07:00
committed by Facebook Github Bot
parent 329b5ddf77
commit 71725de3d7
8 changed files with 71 additions and 60 deletions

View File

@@ -20,10 +20,10 @@ const (
type ExecQuerier interface {
// Exec executes a query that doesn't return rows. For example, in SQL, INSERT or UPDATE.
// It scans the result into the pointer v. In SQL, you it's usually sql.Result.
Exec(ctx context.Context, query string, args interface{}, v interface{}) error
Exec(ctx context.Context, query string, args, v interface{}) error
// Query executes a query that returns rows, typically a SELECT in SQL.
// It scans the result into the pointer v. In SQL, you it's usually *sql.Rows.
Query(ctx context.Context, query string, args interface{}, v interface{}) error
Query(ctx context.Context, query string, args, v interface{}) error
}
// Driver is the interface that wraps all necessary operations for ent clients.
@@ -61,13 +61,13 @@ func Debug(d Driver, logger ...func(...interface{})) Driver {
}
// Exec logs its params and calls the underlying driver Exec method.
func (d *DebugDriver) Exec(ctx context.Context, query string, args interface{}, v interface{}) error {
func (d *DebugDriver) Exec(ctx context.Context, query string, args, v interface{}) error {
d.log(fmt.Sprintf("driver.Exec: query=%v args=%v", query, args))
return d.Driver.Exec(ctx, query, args, v)
}
// Query logs its params and calls the underlying driver Query method.
func (d *DebugDriver) Query(ctx context.Context, query string, args interface{}, v interface{}) error {
func (d *DebugDriver) Query(ctx context.Context, query string, args, v interface{}) error {
d.log(fmt.Sprintf("driver.Query: query=%v args=%v", query, args))
return d.Driver.Query(ctx, query, args, v)
}
@@ -91,13 +91,13 @@ type DebugTx struct {
}
// Exec logs its params and calls the underlying transaction Exec method.
func (d *DebugTx) Exec(ctx context.Context, query string, args interface{}, v interface{}) error {
func (d *DebugTx) Exec(ctx context.Context, query string, args, v interface{}) error {
d.log(fmt.Sprintf("Tx(%s).Exec: query=%v args=%v", d.id, query, args))
return d.Tx.Exec(ctx, query, args, v)
}
// Query logs its params and calls the underlying transaction Query method.
func (d *DebugTx) Query(ctx context.Context, query string, args interface{}, v interface{}) error {
func (d *DebugTx) Query(ctx context.Context, query string, args, v interface{}) error {
d.log(fmt.Sprintf("Tx(%s).Query: query=%v args=%v", d.id, query, args))
return d.Tx.Query(ctx, query, args, v)
}