Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Run migration to create embedding columns if they don't exist #255

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions pkg/store/postgres/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import (
"strings"
"time"

"github.com/getzep/zep/pkg/store/postgres/migrations"

"github.com/Masterminds/semver/v3"
_ "github.com/jackc/pgx/v5/stdlib" // required for pgx to work
"github.com/uptrace/bun/driver/pgdriver"

"github.com/getzep/zep/pkg/llms"
"github.com/getzep/zep/pkg/store/postgres/migrations"
"github.com/uptrace/bun/dialect/pgdialect"

"github.com/getzep/zep/pkg/models"
Expand Down Expand Up @@ -444,6 +445,11 @@ func CreateSchema(
}
}

// apply migrations
if err := migrations.Migrate(ctx, db); err != nil {
return fmt.Errorf("failed to apply migrations: %w", err)
}

// check that the message and summary embedding dimensions match the configured model
if err := checkEmbeddingDims(ctx, appState, db, "message", "message_embedding"); err != nil {
return fmt.Errorf("error checking message embedding dimensions: %w", err)
Expand All @@ -464,11 +470,6 @@ func CreateSchema(
}
}

// apply migrations
if err := migrations.Migrate(ctx, db); err != nil {
return fmt.Errorf("failed to apply migrations: %w", err)
}

return nil
}

Expand Down
Loading