From 464514b2ea1c9b8678fd9ae1c0f1c55b27d80a0a Mon Sep 17 00:00:00 2001 From: Joshua Kroll Date: Thu, 2 Jun 2016 20:07:35 -0700 Subject: [PATCH] Don't run database migrations by commenting out the function that does them. This eliminates silly build-location dependencies. --- clair.go | 2 +- database/pgsql/pgsql.go | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/clair.go b/clair.go index cfb5c850..373c1723 100644 --- a/clair.go +++ b/clair.go @@ -23,10 +23,10 @@ import ( "syscall" "time" + "github.com/cloudflare/clair/database/pgsql" "github.com/coreos/clair/api" "github.com/coreos/clair/api/context" "github.com/coreos/clair/config" - "github.com/coreos/clair/database/pgsql" "github.com/coreos/clair/notifier" "github.com/coreos/clair/updater" "github.com/coreos/clair/utils" diff --git a/database/pgsql/pgsql.go b/database/pgsql/pgsql.go index 15789dd9..94e43281 100644 --- a/database/pgsql/pgsql.go +++ b/database/pgsql/pgsql.go @@ -26,12 +26,12 @@ import ( "time" "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/database" "github.com/coreos/clair/utils" cerrors "github.com/coreos/clair/utils/errors" "github.com/coreos/pkg/capnslog" - "github.com/hashicorp/golang-lru" "github.com/lib/pq" "github.com/pborman/uuid" "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. func Open(config *config.DatabaseConfig) (database.Datastore, error) { - // Run migrations. - if err := migrate(config.Source); err != nil { - log.Error(err) - return nil, database.ErrCantOpen - } + // jkroll 2016-06-02: Cut out migrations to build a package, so we can avoid this runtime + // // Run migrations. + // if err := migrate(config.Source); err != nil { + // log.Error(err) + // return nil, database.ErrCantOpen + // } // Open database. db, err := sql.Open("postgres", config.Source)