<commit_before>package migrations

import (

	// Enable PostgreSQL driver for migration tool
	_ "github.com/mattes/migrate/driver/postgres"
	"github.com/mattes/migrate/migrate"
	"github.com/pkg/errors"
)

func UpgradeDB(databaseURL string) error {
	// TODO Who is responsible to run `create database sentry_ci` statement?
	// TODO consider use async version and optimize app's startup time
	allErrors, ok := migrate.UpSync(databaseURL, "/home/alexey/go/src/github.com/diyan/assimilator/migrations/postgres")
	if !ok {
		// TODO handle error, do not just return the first one
		// pp.Print(allErrors)
		return errors.Wrapf(allErrors[0], "failed to upgrade database schema")
	}
	return nil
}<commit_msg>Use relative path for db migrations<commit_after>package migrations

import (

	// Enable PostgreSQL driver for migration tool
	"path/filepath"

	_ "github.com/mattes/migrate/driver/postgres"
	"github.com/mattes/migrate/migrate"
	"github.com/pkg/errors"
)

func UpgradeDB(databaseURL string) error {
	// TODO Who is responsible to run `create database sentry_ci` statement?
	// TODO consider use async version and optimize app's startup time
	// TODO this relative path works only for single test package, use go.rice instead
	migrationsPath, err := filepath.Abs("../../migrations/postgres")
	if err != nil {
		return errors.Wrap(err, "can not get absolute path for db migrations")
	}
	allErrors, ok := migrate.UpSync(databaseURL, migrationsPath)
	if !ok {
		// TODO handle error, do not just return the first one
		// pp.Print(allErrors)
		return errors.Wrapf(allErrors[0], "failed to upgrade database schema")
	}
	return nil
}
{'fraction_non_alphanumeric': 0.1043585021485574, 'fraction_numerical': 0.0012277470841006752, 'mean_word_length': 4.292207792207792, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2098670', 'n_tokens_mistral': 519, 'n_tokens_neox': 515, 'n_words': 159}