diff --git a/setup_sql/01_schema.sql b/setup_sql/01_schema.sql index c41c207..92caf22 100644 --- a/setup_sql/01_schema.sql +++ b/setup_sql/01_schema.sql @@ -70,7 +70,12 @@ CREATE TABLE IF NOT EXISTS fc.log ( COMMENT ON TABLE fc.log IS 'forecast change log'; -CREATE TABLE IF NOT EXISTS fc.sql(cmd text PRIMARY KEY, t text ); +CREATE TABLE IF NOT EXISTS fc.sql( + target text + ,cmd text + ,t text + ,PRIMARY KEY (target, cmd) +); CREATE TABLE fc.perd ( comp numeric(2,0), diff --git a/setup_sql/04_gen_baseline.sql b/setup_sql/04_gen_baseline.sql index 988097b..2c4e26d 100644 --- a/setup_sql/04_gen_baseline.sql +++ b/setup_sql/04_gen_baseline.sql @@ -270,7 +270,7 @@ INTO RAISE NOTICE E'_sql ---------> \n%',_sql; -INSERT INTO fc.sql SELECT 'baseline', _sql ON CONFLICT ON CONSTRAINT sql_pkey DO UPDATE SET t = EXCLUDED.t; +INSERT INTO fc.sql SELECT _target_table, 'baseline', _sql ON CONFLICT ON CONSTRAINT sql_pkey DO UPDATE SET t = EXCLUDED.t; END $func$; diff --git a/setup_sql/05_gen_scale.sql b/setup_sql/05_gen_scale.sql index 74dc306..2c4d0be 100644 --- a/setup_sql/05_gen_scale.sql +++ b/setup_sql/05_gen_scale.sql @@ -267,7 +267,7 @@ INTO RAISE NOTICE '%', _sql; -INSERT INTO fc.sql SELECT 'scale', _sql ON CONFLICT (cmd) DO UPDATE SET t = EXCLUDED.t; +INSERT INTO fc.sql SELECT _target_table, 'scale', _sql ON CONFLICT ON CONSTRAINT sql_pkey DO UPDATE SET t = EXCLUDED.t; END $func$; diff --git a/test/baseline/curl.sh b/test/baseline/curl.sh old mode 100644 new mode 100755 index c8f4b09..c6f861a --- a/test/baseline/curl.sh +++ b/test/baseline/curl.sh @@ -1 +1 @@ -curl -H "Content-Type: application/json" -X GET -d@./routes/baseline/req.json http://localhost:8082/baseline +curl -H "Content-Type: application/json" -X GET -d@./test/baseline/req.json http://localhost:8082/baseline diff --git a/test/scale/curl_route.sh b/test/scale/curl_route.sh old mode 100644 new mode 100755 index ec9f203..b07bb18 --- a/test/scale/curl_route.sh +++ b/test/scale/curl_route.sh @@ -1 +1 @@ -curl -H "Content-Type: application/json" -X GET -d@./routes/scale/req_dcard.json http://localhost:8082/scale +curl -H "Content-Type: application/json" -X GET -d@./test/scale/req_dcard.json http://localhost:8082/scale