Index: branches/eam_branches/ipp-20121219/dbconfig/changes.txt
===================================================================
--- branches/eam_branches/ipp-20121219/dbconfig/changes.txt	(revision 34857)
+++ branches/eam_branches/ipp-20121219/dbconfig/changes.txt	(revision 35096)
@@ -2265,2 +2265,73 @@
 ALTER TABLE skycalResult ADD column n_forced INT after n_extended;
 UPDATE dbversion set schema_version = '1.1.73', updated= CURRENT_TIMESTAMP();
+
+
+-- new tables for managing the "release" of ipp data
+
+CREATE TABLE survey (
+    surveyID    INT(8),
+    surveyName  VARCHAR(16) NOT NULL,
+    description VARCHAR(255),
+    PRIMARY KEY(surveyID),
+    UNIQUE  KEY(surveyName)
+) ENGINE=InnoDB CHARSET=latin1;
+
+
+CREATE TABLE ippRelease (
+    rel_id      INT(8) AUTO_INCREMENT,
+    surveyID    INT(8),
+    releaseName VARCHAR(64),
+    release_state VARCHAR(16),    -- active, pending archive drop 
+    dataRelease INT(8),         -- PSPS dataRelease
+    PRIMARY KEY(rel_id),
+    KEY(releaseName),
+    KEY(state),
+    FOREIGN KEY(surveyID) REFERENCES survey(surveyID)
+) ENGINE=Innodb DEFAULT CHARSET=latin1;
+
+CREATE TABLE relExp (
+    relexp_id   BIGINT AUTO_INCREMENT,
+    rel_id      INT(8),
+    exp_id      BIGINT,
+    chip_id     BIGINT,         -- links to the runs that supplied the data
+    cam_id      BIGINT,         -- for this release
+    state       VARCHAR(16),    -- released, pending, archive, drop  
+    flags       INT UNSIGNED,   -- flags for relphot, relastro, ??
+    zpt_obs     FLOAT,          -- calibrated zero point for this release of
+    zpt_stdev   FLOAT,          -- this exposure
+    path_base   VARCHAR(255),   -- path_base of any supporting files for this
+                                -- release of this exposure.
+    registered  DATETIME,       -- insertion time for this row
+    time_stamp  DATETIME,       -- time of last update for this row
+    PRIMARY KEY (relexp_id),
+    FOREIGN KEY(rel_id) REFERENCES ippRelease(rel_id),
+    KEY (state),
+    FOREIGN KEY(exp_id) REFERENCES rawExp(exp_id),
+    FOREIGN KEY(chip_id) REFERENCES chipRun(chip_id),
+    FOREIGN KEY(cam_id) REFERENCES camRun(cam_id)
+) ENGINE=innodb DEFAULT CHARSET=latin1;
+
+CREATE TABLE relStack (
+    relstack_id BIGINT AUTO_INCREMENT,
+    rel_id      INT(8),
+    skycal_id   BIGINT,         -- id of the sky calibration run that supplied the calibration
+                                -- for this release. We get back to stack from here
+    skycell_id  varchar(64),
+    tess_id     varchar(64),
+    state       VARCHAR(16),    -- released, pending, archive, drop  
+    flags       INT UNSIGNED,
+    stack_type  VARCHAR(16),    -- nightly, deep, reference
+    zpt_obs     FLOAT,          -- calibrated zero point for this release of this skycell
+    zpt_stdev   FLOAT,
+    fwhm_major  FLOAT,          -- seeing as measured by staticsky
+    path_base   VARCHAR(255),   -- path_base of any supporting files,
+    registered  DATETIME,
+    time_stamp  DATETIME,
+    PRIMARY KEY (relstack_id),
+    KEY (tess_id, skycell_id),
+    KEY (rel_id, tess_id, skycell_id),
+    FOREIGN KEY(rel_id) REFERENCES ippRelease(rel_id),
+    FOREIGN KEY(skycal_id) REFERENCES skycalRun(skycal_id)
+) ENGINE=innodb DEFAULT CHARSET=latin1;
+
+UPDATE dbversion set schema_version = '1.1.74', updated= CURRENT_TIMESTAMP();
