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: migrate.go
    path of file: ./repos/gitness/app/store/database/migrate
    
    the code of the file until where you have to start completion: // Copyright 2023 Harness, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package migrate

import (
	"context"
	"database/sql"
	"embed"
	"fmt"
	"io/fs"

	"github.com/jmoiron/sqlx"
	"github.com/maragudk/migrate"
	"github.com/rs/zerolog/log"
)

//go:embed postgres/*.sql
var postgres embed.FS

//go:embed sqlite/*.sql
var sqlite embed.FS

const (
	tableName = "migrations"

	po
    
func getMigrator(db *sqlx.DB) (migrate.Options, error) {
	before := func(ctx context.Context, _ *sql.Tx, version string) error {
		ctx = log.Ctx(ctx).With().
			Str("migrate.version", version).
			Str("migrate.phase", "before").
			Logger().WithContext(ctx)
		log := log.Ctx(ctx)

		log.Info().Msg("[START]")
		defer log.Info().Msg("[DONE]")

		return nil
	}

	after := func(ctx context.Context, dbtx *sql.Tx, version string) error {
		ctx = log.Ctx(ctx).With().
			Str("migrate.version", version).
			Str("migrate.phase", "after").
			Logger().WithContext(ctx)
		log := log.Ctx(ctx)

		log.Info().Msg("[START]")
		defer log.Info().Msg("[DONE]")

		switch version {
		case "0039_alter_table_webhooks_uid":
			return migrateAfter_0039_alter_table_webhooks_uid(ctx, dbtx)
		case "0042_alter_table_rules":
			return migrateAfter_0042_alter_table_rules(ctx, dbtx)
		default:
			return nil
		}
	}

	opts := migrate.Options{
		After:  after,
		Before: before,
		DB:     db.DB,
		FS:     sqlite,
		Table:  tableName,
	}

	switch db.DriverName() {
	case sqliteDriverName:
		folder, _ := fs.Sub(sqlite, sqliteSourceDir)
		opts.FS = folder
	case postgresDriverName:
		folder, _ := fs.Sub(postgres, postgresSourceDir)
		opts.FS = folder

	default:
		return migrate.Options{}, fmt.Errorf("unsupported driver '%s'", db.DriverName())
	}

	return opts, nil
}