Skip to content

Commit

Permalink
Change schema of OperatorBundle to include field 'bundlepath'.
Browse files Browse the repository at this point in the history
Migrate older database to new schema.
Extend API to allow querying of the new `bundlepath` field.
  • Loading branch information
anik120 committed Oct 21, 2019
1 parent 3aa6ddd commit 41cdf58
Show file tree
Hide file tree
Showing 13 changed files with 391 additions and 96 deletions.
18 changes: 18 additions & 0 deletions cmd/opm/registry/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package registry

import (
"context"
"database/sql"
"net"

"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -57,6 +58,23 @@ func runRegistryServeCmdFunc(cmd *cobra.Command, args []string) error {
return err
}

db, err := sql.Open("sqlite3", dbName) // TODO: ?immutable=true
if err != nil {
return err
}

// Migrate database to latest version before serving
migrator, err := sqlite.NewSQLLiteMigrator(db, "")
if err != nil {
return err
}
defer migrator.CleanUpMigrator()

err = migrator.MigrateUp()
if err != nil {
return err
}

port, err := cmd.Flags().GetString("port")
if err != nil {
return err
Expand Down
7 changes: 7 additions & 0 deletions pkg/api/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,10 @@ func BundleStringToAPIBundle(bundleString string, entry *registry.ChannelEntry)
out.PackageName = entry.PackageName
return out, nil
}

func BundlePathStringToAPIBundlePath(bundlePath string) *BundlePath {
out := &BundlePath{
Path: bundlePath,
}
return out
}
Loading

0 comments on commit 41cdf58

Please sign in to comment.