You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: parse.go
    path of file: ./repos/graphql-engine/cli/migrate/source
    
    the code of the file until where you have to start completion: package source

import (
	"fmt"
	"io/ioutil"
	"path/filepath"
	"regexp"
	"strconv"

	"github.com/goccy/go-yaml"

	"github.com/hasura/graphql-engine/cli/v2/internal/error
    
func IsEmptyFile(m *Migration, directory string) (bool, error) {
	var op errors.Op = "source.IsEmptyFile"
	data, err := ioutil.ReadFile(filepath.Join(directory, m.Raw))
	if err != nil {
		return false, errors.E(op, fmt.Errorf("cannot read file %s: %w", m.Raw, err))
	}
	switch direction := m.Direction; direction {
	case MetaUp, MetaDown:
		var t []interface{}
		err = yaml.Unmarshal(data, &t)
		if err != nil {
			return false, errors.E(op, fmt.Errorf("invalid yaml file: %s: %w", m.Raw, err))
		}
		if len(t) == 0 {
			return false, nil
		}
	case Up, Down:
		if string(data[:]) == "" {
			return false, nil
		}
	}
	return true, nil
}