Migration parsing
(id string, r io.ReadSeeker)
| 416 | |
| 417 | // Migration parsing |
| 418 | func ParseMigration(id string, r io.ReadSeeker) (*Migration, error) { |
| 419 | m := &Migration{ |
| 420 | Id: id, |
| 421 | } |
| 422 | |
| 423 | parsed, err := sqlparse.ParseMigration(r) |
| 424 | if err != nil { |
| 425 | return nil, fmt.Errorf("Error parsing migration (%s): %w", id, err) |
| 426 | } |
| 427 | |
| 428 | m.Up = parsed.UpStatements |
| 429 | m.Down = parsed.DownStatements |
| 430 | |
| 431 | m.DisableTransactionUp = parsed.DisableTransactionUp |
| 432 | m.DisableTransactionDown = parsed.DisableTransactionDown |
| 433 | |
| 434 | return m, nil |
| 435 | } |
| 436 | |
| 437 | type SqlExecutor interface { |
| 438 | Exec(query string, args ...interface{}) (sql.Result, error) |
no test coverage detected
searching dependent graphs…