diff --git a/setup_sql/schema.sql b/setup_sql/schema.sql index 2859997..c0f7b9e 100644 --- a/setup_sql/schema.sql +++ b/setup_sql/schema.sql @@ -1,4 +1,4 @@ ---assumes schema fc already exists +CREATE SCHEMA IF NOT EXISTS fc; --DROP TABLE IF EXISTS fc.target_meta; CREATE TABLE IF NOT EXISTS fc.target_meta ( @@ -15,7 +15,7 @@ CREATE TABLE IF NOT EXISTS fc.target_meta ( ); --ALTER TABLE fc.target_meta DROP CONSTRAINT IF EXISTS target_meta_pk; -ALTER TABLE fc.target_meta ADD CONSTRAINT IF NOT EXISTS target_meta_pk PRIMARY KEY (tname, cname); +ALTER TABLE fc.target_meta ADD CONSTRAINT target_meta_pk PRIMARY KEY (tname, cname); COMMENT ON TABLE fc.target_meta IS 'target table layout info'; COMMENT ON COLUMN fc.target_meta.tname IS 'schema.table_name of target sales data table'; @@ -35,3 +35,5 @@ 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 );