Don't run database migrations by commenting out the function that does them. This eliminates silly build-location dependencies.

This commit is contained in:
Joshua Kroll 2016-06-02 20:07:35 -07:00
parent cc22bd284c
commit 464514b2ea
2 changed files with 8 additions and 7 deletions

View File

@ -23,10 +23,10 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/cloudflare/clair/database/pgsql"
"github.com/coreos/clair/api" "github.com/coreos/clair/api"
"github.com/coreos/clair/api/context" "github.com/coreos/clair/api/context"
"github.com/coreos/clair/config" "github.com/coreos/clair/config"
"github.com/coreos/clair/database/pgsql"
"github.com/coreos/clair/notifier" "github.com/coreos/clair/notifier"
"github.com/coreos/clair/updater" "github.com/coreos/clair/updater"
"github.com/coreos/clair/utils" "github.com/coreos/clair/utils"

View File

@ -26,12 +26,12 @@ import (
"time" "time"
"bitbucket.org/liamstask/goose/lib/goose" "bitbucket.org/liamstask/goose/lib/goose"
"github.com/cloudflare/clair/vendor/github.com/hashicorp/golang-lru"
"github.com/coreos/clair/config" "github.com/coreos/clair/config"
"github.com/coreos/clair/database" "github.com/coreos/clair/database"
"github.com/coreos/clair/utils" "github.com/coreos/clair/utils"
cerrors "github.com/coreos/clair/utils/errors" cerrors "github.com/coreos/clair/utils/errors"
"github.com/coreos/pkg/capnslog" "github.com/coreos/pkg/capnslog"
"github.com/hashicorp/golang-lru"
"github.com/lib/pq" "github.com/lib/pq"
"github.com/pborman/uuid" "github.com/pborman/uuid"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
@ -96,11 +96,12 @@ func (pgSQL *pgSQL) Ping() bool {
// //
// It will run immediately every necessary migration on the database. // It will run immediately every necessary migration on the database.
func Open(config *config.DatabaseConfig) (database.Datastore, error) { func Open(config *config.DatabaseConfig) (database.Datastore, error) {
// Run migrations. // jkroll 2016-06-02: Cut out migrations to build a package, so we can avoid this runtime
if err := migrate(config.Source); err != nil { // // Run migrations.
log.Error(err) // if err := migrate(config.Source); err != nil {
return nil, database.ErrCantOpen // log.Error(err)
} // return nil, database.ErrCantOpen
// }
// Open database. // Open database.
db, err := sql.Open("postgres", config.Source) db, err := sql.Open("postgres", config.Source)