From 63bb215cd209638b885dd1b9d0a0266d38a8391d Mon Sep 17 00:00:00 2001 From: Travis Reeder Date: Wed, 10 Aug 2016 14:03:01 -0700 Subject: [PATCH] Fixed some postgres bugs. --- api/datastore/postgres/postgres.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/datastore/postgres/postgres.go b/api/datastore/postgres/postgres.go index 63fa3a88b..ba5cd55f9 100644 --- a/api/datastore/postgres/postgres.go +++ b/api/datastore/postgres/postgres.go @@ -16,7 +16,8 @@ CREATE TABLE IF NOT EXISTS routes ( app_name character varying(256) NOT NULL, path text NOT NULL, image character varying(256) NOT NULL, - headers text NOT NULL + headers text NOT NULL, + PRIMARY KEY (app_name, path) );` const appsTableCreate = `CREATE TABLE IF NOT EXISTS apps ( @@ -169,7 +170,7 @@ func (ds *PostgresDatastore) StoreRoute(route *models.Route) (*models.Route, err headers ) VALUES ($1, $2, $3, $4) - ON CONFLICT (name) DO UPDATE SET + ON CONFLICT (app_name, path) DO UPDATE SET path = $2, image = $3, headers = $4;