 
 
 --
--- Name: CircuitData_pkey; Type: CONSTRAINT; Schema: public; Owner: sepgroup; Tablespace: 
+-- Name: CircuitData_pkey1; Type: CONSTRAINT; Schema: public; Owner: sepgroup; Tablespace: 
 --
 
 ALTER TABLE ONLY "CircuitData"
-    ADD CONSTRAINT "CircuitData_pkey" PRIMARY KEY (circuit, "timestamp");
+    ADD CONSTRAINT "CircuitData_pkey1" PRIMARY KEY (circuit, "timestamp");
 
 
 --

ALTER TABLE public."_IrradianceFifteenMinIntervals" OWNER TO postgres;

--
-- Name: az_houses_all_with_smart_meter; Type: VIEW; Schema: public; Owner: eileen
--

CREATE VIEW az_houses_all_with_smart_meter AS
    SELECT "MeterLocationHistory".address, "MeterLocationHistory".old_service_point_id AS service_point_id, "MeterLocationHistory".service_point_id AS new_service_point_id FROM "MeterLocationHistory" WHERE ("MeterLocationHistory".uninstalled IS NULL);


ALTER TABLE public.az_houses_all_with_smart_meter OWNER TO eileen;

--

CREATE VIEW readings_before_install AS
    SELECT "MeterLocationHistory".meter_name, "MeterLocationHistory".service_point_id, "MeterLocationHistory".service_point_latitude, "MeterLocationHistory".service_point_longitude, "MeterLocationHistory".location, "MeterLocationHistory".address, "MeterLocationHistory".latitude, "MeterLocationHistory".longitude, "MeterLocationHistory".installed, "MeterLocationHistory".uninstalled, "Reading".channel, "Reading".raw_value, "Reading".value, "Reading".uom, "Interval".end_time, "MeterData".meter_data_id FROM (((("MeterLocationHistory" JOIN "MeterData" ON ((("MeterLocationHistory".meter_name)::bpchar = "MeterData".meter_name))) JOIN "IntervalReadData" ON (("MeterData".meter_data_id = "IntervalReadData".meter_data_id))) JOIN "Interval" ON (("IntervalReadData".interval_read_data_id = "Interval".interval_read_data_id))) JOIN "Reading" ON ((("Interval".interval_id = "Reading".interval_id) AND ("Interval".end_time < "MeterLocationHistory".installed))));


ALTER TABLE public.readings_before_install OWNER TO postgres;
