CREATE TABLE pv_energy_by_month ( id serial NOT NULL PRIMARY KEY, month integer NOT NULL, year integer NOT NULL, created_at timestamp NOT NULL DEFAULT now(), last_changed timestamp, update_counter integer NOT NULL DEFAULT 0, baseline_energy real NOT NULL, current_energy real NOT NULL DEFAULT 0.0, CONSTRAINT pv_energy_by_month__month_year_unique UNIQUE(month, year) );