func Migrate(db *sql.DB) error {
	fs, err := getMigrations(db)
	if err != nil {
		return err
	}
	driver, err := postgres.WithInstance(db, &postgres.Config{})
	if err != nil {
		return err
	}
	mig, err := migrate.NewWithInstance("godoc-vfs", fs, "postgres", driver)
	if err != nil {
		return err
	}
	mig.Log = &logrusAdapter{}
	err = mig.Up()
	if err != nil && err != migrate.ErrNoChange {
		return xerrors.Errorf("error during migration: %w", err)
	}
	return nil
}
Migrate ensures that the database has the current schema required for using any of the postgres storage
package postgres
import (
	"database/sql"
	"os"
	rice "github.com/GeertJohan/go.rice"
	"github.com/golang-migrate/migrate/v4"
	"github.com/golang-migrate/migrate/v4/database/postgres"
	"github.com/golang-migrate/migrate/v4/source"
	"github.com/golang-migrate/migrate/v4/source/godoc_vfs"
	log "github.com/sirupsen/logrus"
	"golang.org/x/tools/godoc/vfs/mapfs"
	"golang.org/x/xerrors"
)