From 6e30b5328036d30dae1ea054518c3d59bfb9186d Mon Sep 17 00:00:00 2001 From: Dominic Wong Date: Fri, 28 Aug 2020 10:35:47 +0100 Subject: [PATCH] fix cockroach init to create table in correct database (#1977) --- store/cockroach/cockroach.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/store/cockroach/cockroach.go b/store/cockroach/cockroach.go index 5e31cc7d..c7801e8c 100644 --- a/store/cockroach/cockroach.go +++ b/store/cockroach/cockroach.go @@ -98,20 +98,15 @@ func (s *sqlStore) initDB(database, table string) error { return err } - _, err = s.db.Exec(fmt.Sprintf("SET DATABASE = %s;", database)) - if err != nil { - return errors.Wrap(err, "Couldn't set database") - } - // Create a table for the namespace's prefix - _, err = s.db.Exec(fmt.Sprintf(`CREATE TABLE IF NOT EXISTS %s + _, err = s.db.Exec(fmt.Sprintf(`CREATE TABLE IF NOT EXISTS %s.%s ( key text NOT NULL, value bytea, metadata JSONB, expiry timestamp with time zone, CONSTRAINT %s_pkey PRIMARY KEY (key) - );`, table, table)) + );`, database, table, table)) if err != nil { return errors.Wrap(err, "Couldn't create table") }