remove unexistent route properties

This commit is contained in:
Pedro Nasser
2016-07-27 17:50:27 -03:00
parent e7e067ff71
commit c8303a7295

View File

@@ -17,8 +17,6 @@ CREATE TABLE IF NOT EXISTS routes (
path text NOT NULL, path text NOT NULL,
app_name character varying(256) NOT NULL, app_name character varying(256) NOT NULL,
image character varying(256) NOT NULL, image character varying(256) NOT NULL,
type character varying(256) NOT NULL,
container_path text NOT NULL,
headers text NOT NULL headers text NOT NULL
);` );`
@@ -26,7 +24,7 @@ const appsTableCreate = `CREATE TABLE IF NOT EXISTS apps (
name character varying(256) NOT NULL PRIMARY KEY name character varying(256) NOT NULL PRIMARY KEY
);` );`
const routeSelector = `SELECT name, path, app_name, image, type, container_path, headers FROM routes` const routeSelector = `SELECT name, path, app_name, image, headers FROM routes`
type rowScanner interface { type rowScanner interface {
Scan(dest ...interface{}) error Scan(dest ...interface{}) error
@@ -162,22 +160,18 @@ func (ds *PostgresDatastore) StoreRoute(route *models.Route) (*models.Route, err
_, err = ds.db.Exec(` _, err = ds.db.Exec(`
INSERT INTO routes ( INSERT INTO routes (
name, app_name, path, image, name, app_name, path, image,
type, container_path, headers headers
) )
VALUES ($1, $2, $3, $4, $5, $6, $7) VALUES ($1, $2, $3, $4, $5, $6, $7)
ON CONFLICT (name) DO UPDATE SET ON CONFLICT (name) DO UPDATE SET
path = $3, path = $3,
image = $4, image = $4,
type = $5, headers = $5;
container_path = $6,
headers = $7;
`, `,
route.Name, route.Name,
route.AppName, route.AppName,
route.Path, route.Path,
route.Image, route.Image,
route.Type,
route.ContainerPath,
headers, headers,
) )
@@ -206,8 +200,6 @@ func scanRoute(scanner rowScanner, route *models.Route) error {
&route.Path, &route.Path,
&route.AppName, &route.AppName,
&route.Image, &route.Image,
&route.Type,
&route.ContainerPath,
&headerStr, &headerStr,
) )