db: lsstSchema4mysql_2.9.0_comments.sql

File lsstSchema4mysql_2.9.0_comments.sql, 88.7 KB (added by jbecla, 11 years ago)
Line 
1CREATE TABLE _DIASource2Alert
2(
3        diaSourceId BIGINT NOT NULL COMMENT 'Pointer to an entry in DIASource table',
4        alertId INTEGER NOT NULL COMMENT 'Pointer to an entry in Alert table',
5        KEY (alertId),
6        KEY (diaSourceId)
7)  COMMENT='Mapping: DIASource --> alerts generated by the object';
8
9
10CREATE TABLE VarObject
11(
12        objectId BIGINT NOT NULL COMMENT 'Unique id.',
13        ra DOUBLE NOT NULL,
14        decl DOUBLE NOT NULL,
15        raErr FLOAT(0) NOT NULL,
16        declErr FLOAT(0) NOT NULL,
17        flag4stage1 INTEGER NULL COMMENT 'Problem/special condition flag reported by one stage. FIXME: replace with real Stage name',
18        flag4stage2 INTEGER NULL COMMENT 'Problem/special condition flag reported by one stage. FIXME: replace with real Stage name',
19        flag4stage3 INTEGER NULL COMMENT 'Problem/special condition flag reported by one stage. FIXME: replace with real Stage name',
20        uAmplitude FLOAT(0) NULL,
21        uPeriod FLOAT(0) NULL,
22        uTimescale FLOAT(0) NULL,
23        gAmplitude FLOAT(0) NULL,
24        gPeriod FLOAT(0) NULL,
25        gTimescale FLOAT(0) NULL,
26        rAmplitude FLOAT(0) NULL,
27        rPeriod FLOAT(0) NULL,
28        rTimescale FLOAT(0) NULL,
29        iAmplitude FLOAT(0) NULL,
30        iPeriod FLOAT(0) NULL,
31        iTimescale FLOAT(0) NULL,
32        zAmplitude FLOAT(0) NULL,
33        zPeriod FLOAT(0) NULL,
34        zTimescale FLOAT(0) NULL,
35        yAmplitude FLOAT(0) NULL,
36        yPeriod FLOAT(0) NULL,
37        yTimescale FLOAT(0) NULL,
38        uScalegram01 FLOAT(0) NULL COMMENT '"Scalegram": time series as the average of the squares of the wavelet coefficients at a given scale. See Scargel et al 1993 for more details.',
39        uScalegram02 FLOAT(0) NULL,
40        uScalegram03 FLOAT(0) NULL,
41        uScalegram04 FLOAT(0) NULL,
42        uScalegram05 FLOAT(0) NULL,
43        uScalegram06 FLOAT(0) NULL,
44        uScalegram07 FLOAT(0) NULL,
45        uScalegram08 FLOAT(0) NULL,
46        uScalegram09 FLOAT(0) NULL,
47        uScalegram10 FLOAT(0) NULL,
48        uScalegram11 FLOAT(0) NULL,
49        uScalegram12 FLOAT(0) NULL,
50        uScalegram13 FLOAT(0) NULL,
51        uScalegram14 FLOAT(0) NULL,
52        uScalegram15 FLOAT(0) NULL,
53        uScalegram16 FLOAT(0) NULL,
54        uScalegram17 FLOAT(0) NULL,
55        uScalegram18 FLOAT(0) NULL,
56        uScalegram19 FLOAT(0) NULL,
57        uScalegram20 FLOAT(0) NULL,
58        uScalegram21 FLOAT(0) NULL,
59        uScalegram22 FLOAT(0) NULL,
60        uScalegram23 FLOAT(0) NULL,
61        uScalegram24 FLOAT(0) NULL,
62        uScalegram25 FLOAT(0) NULL,
63        gScalegram01 FLOAT(0) NULL,
64        gScalegram02 FLOAT(0) NULL,
65        gScalegram03 FLOAT(0) NULL,
66        gScalegram04 FLOAT(0) NULL,
67        gScalegram05 FLOAT(0) NULL,
68        gScalegram06 FLOAT(0) NULL,
69        gScalegram07 FLOAT(0) NULL,
70        gScalegram08 FLOAT(0) NULL,
71        gScalegram09 FLOAT(0) NULL,
72        gScalegram10 FLOAT(0) NULL,
73        gScalegram11 FLOAT(0) NULL,
74        gScalegram12 FLOAT(0) NULL,
75        gScalegram13 FLOAT(0) NULL,
76        gScalegram14 FLOAT(0) NULL,
77        gScalegram15 FLOAT(0) NULL,
78        gScalegram16 FLOAT(0) NULL,
79        gScalegram17 FLOAT(0) NULL,
80        gScalegram18 FLOAT(0) NULL,
81        gScalegram19 FLOAT(0) NULL,
82        gScalegram20 FLOAT(0) NULL,
83        gScalegram21 FLOAT(0) NULL,
84        gScalegram22 FLOAT(0) NULL,
85        gScalegram23 FLOAT(0) NULL,
86        gScalegram24 FLOAT(0) NULL,
87        gScalegram25 FLOAT(0) NULL,
88        rScalegram01 FLOAT(0) NULL,
89        rScalegram02 FLOAT(0) NULL,
90        rScalegram03 FLOAT(0) NULL,
91        rScalegram04 FLOAT(0) NULL,
92        rScalegram05 FLOAT(0) NULL,
93        rScalegram06 FLOAT(0) NULL,
94        rScalegram07 FLOAT(0) NULL,
95        rScalegram08 FLOAT(0) NULL,
96        rScalegram09 FLOAT(0) NULL,
97        rScalegram10 FLOAT(0) NULL,
98        rScalegram11 FLOAT(0) NULL,
99        rScalegram12 FLOAT(0) NULL,
100        rScalegram13 FLOAT(0) NULL,
101        rScalegram14 FLOAT(0) NULL,
102        rScalegram15 FLOAT(0) NULL,
103        rScalegram16 FLOAT(0) NULL,
104        rScalegram17 FLOAT(0) NULL,
105        rScalegram18 FLOAT(0) NULL,
106        rScalegram19 FLOAT(0) NULL,
107        rScalegram20 FLOAT(0) NULL,
108        rScalegram21 FLOAT(0) NULL,
109        rScalegram22 FLOAT(0) NULL,
110        rScalegram23 FLOAT(0) NULL,
111        rScalegram24 FLOAT(0) NULL,
112        rScalegram25 FLOAT(0) NULL,
113        iScalegram01 FLOAT(0) NULL,
114        iScalegram02 FLOAT(0) NULL,
115        iScalegram03 FLOAT(0) NULL,
116        iScalegram04 FLOAT(0) NULL,
117        iScalegram05 FLOAT(0) NULL,
118        iScalegram06 FLOAT(0) NULL,
119        iScalegram07 FLOAT(0) NULL,
120        iScalegram08 FLOAT(0) NULL,
121        iScalegram09 FLOAT(0) NULL,
122        iScalegram10 FLOAT(0) NULL,
123        iScalegram11 FLOAT(0) NULL,
124        iScalegram12 FLOAT(0) NULL,
125        iScalegram13 FLOAT(0) NULL,
126        iScalegram14 FLOAT(0) NULL,
127        iScalegram15 FLOAT(0) NULL,
128        iScalegram16 FLOAT(0) NULL,
129        iScalegram17 FLOAT(0) NULL,
130        iScalegram18 FLOAT(0) NULL,
131        iScalegram19 FLOAT(0) NULL,
132        iScalegram20 FLOAT(0) NULL,
133        iScalegram21 FLOAT(0) NULL,
134        iScalegram22 FLOAT(0) NULL,
135        iScalegram23 FLOAT(0) NULL,
136        iScalegram24 FLOAT(0) NULL,
137        iScalegram25 FLOAT(0) NULL,
138        zScalegram01 FLOAT(0) NULL,
139        zScalegram02 FLOAT(0) NULL,
140        zScalegram03 FLOAT(0) NULL,
141        zScalegram04 FLOAT(0) NULL,
142        zScalegram05 FLOAT(0) NULL,
143        zScalegram06 FLOAT(0) NULL,
144        zScalegram07 FLOAT(0) NULL,
145        zScalegram08 FLOAT(0) NULL,
146        zScalegram09 FLOAT(0) NULL,
147        zScalegram10 FLOAT(0) NULL,
148        zScalegram11 FLOAT(0) NULL,
149        zScalegram12 FLOAT(0) NULL,
150        zScalegram13 FLOAT(0) NULL,
151        zScalegram14 FLOAT(0) NULL,
152        zScalegram15 FLOAT(0) NULL,
153        zScalegram16 FLOAT(0) NULL,
154        zScalegram17 FLOAT(0) NULL,
155        zScalegram18 FLOAT(0) NULL,
156        zScalegram19 FLOAT(0) NULL,
157        zScalegram20 FLOAT(0) NULL,
158        zScalegram21 FLOAT(0) NULL,
159        zScalegram22 FLOAT(0) NULL,
160        zScalegram23 FLOAT(0) NULL,
161        zScalegram24 FLOAT(0) NULL,
162        zScalegram25 FLOAT(0) NULL,
163        yScalegram01 FLOAT(0) NULL,
164        yScalegram02 FLOAT(0) NULL,
165        yScalegram03 FLOAT(0) NULL,
166        yScalegram04 FLOAT(0) NULL,
167        yScalegram05 FLOAT(0) NULL,
168        yScalegram06 FLOAT(0) NULL,
169        yScalegram07 FLOAT(0) NULL,
170        yScalegram08 FLOAT(0) NULL,
171        yScalegram09 FLOAT(0) NULL,
172        yScalegram10 FLOAT(0) NULL,
173        yScalegram11 FLOAT(0) NULL,
174        yScalegram12 FLOAT(0) NULL,
175        yScalegram13 FLOAT(0) NULL,
176        yScalegram14 FLOAT(0) NULL,
177        yScalegram15 FLOAT(0) NULL,
178        yScalegram16 FLOAT(0) NULL,
179        yScalegram17 FLOAT(0) NULL,
180        yScalegram18 FLOAT(0) NULL,
181        yScalegram19 FLOAT(0) NULL,
182        yScalegram20 FLOAT(0) NULL,
183        yScalegram21 FLOAT(0) NULL,
184        yScalegram22 FLOAT(0) NULL,
185        yScalegram23 FLOAT(0) NULL,
186        yScalegram24 FLOAT(0) NULL,
187        yScalegram25 FLOAT(0) NULL,
188        primaryPeriod FLOAT(0) NULL,
189        primaryPeriodErr FLOAT(0) NULL,
190        uPeriodErr FLOAT(0) NULL,
191        gPeriodErr FLOAT(0) NULL,
192        rPeriodErr FLOAT(0) NULL,
193        iPeriodErr FLOAT(0) NULL,
194        zPeriodErr FLOAT(0) NULL,
195        yPeriodErr FLOAT(0) NULL,
196        PRIMARY KEY (objectId),
197        KEY (objectId)
198)  COMMENT='Table to store Variable Objects - this will keep a COPY of variable objects. All variable objects will be stored in the Object table. Main reasons to have this table is improving access speed to variable objects.';
199
200
201CREATE TABLE Source
202(
203        sourceId BIGINT NOT NULL COMMENT 'Unique id.',
204        ampExposureId BIGINT NULL COMMENT 'Pointer to Amplifier where source was measured. If the Source belongs to multiple AmpExposures, then table Source2AmpExposure is used, and this pointer is NULL',
205        filterId TINYINT NOT NULL COMMENT 'Pointer to an entry in Filter table: filter used to take Exposure where this Source (or these Sources) were measured.',
206        objectId BIGINT NULL COMMENT 'Pointer to Object table. Might be NULL (each Source will point to either MovingObject or Object)',
207        movingObjectId BIGINT NULL COMMENT 'Pointer to MovingObject table. Might be NULL (each Source will point to either MovingObject or Object)',
208        procHistoryId INTEGER NOT NULL COMMENT 'Pointer to an entry in ProcessingHistory table.',
209        ra DOUBLE NOT NULL COMMENT 'RA-coordinate of the source centroid (degrees). Need to support accuracy ~0.0001 arcsec',
210        decl DOUBLE NOT NULL COMMENT 'Dec coordinate of the source centroid (degrees). Need to support accuracy ~0.0001 arcsec',
211        __zoneId_placeholder INTEGER NULL,
212        raErr4wcs FLOAT(0) NOT NULL COMMENT 'Error in centroid RA coordinate (miliarcsec) coming from WCS Stage.',
213        decErr4wcs FLOAT(0) NOT NULL COMMENT 'Error in centroid Dec coordinate (miliarcsec) coming from WCS Stage.',
214        raErr4detection FLOAT(0) NULL COMMENT 'Error in centroid RA coordinate (miliarcsec) coming from Detection Pipeline [FIXME, maybe use Stage name here?].',
215        decErr4detection FLOAT(0) NULL COMMENT 'Error in centroid Dec coordinate (miliarcsec) coming from Detection Pipeline [FIXME, maybe use Stage name here?].',
216        row DOUBLE NOT NULL COMMENT 'Pixel coordinate (Y) of the source centroid.',
217        col DOUBLE NOT NULL COMMENT 'Pixel coordinate (X) of the source centroid.',
218        rowErr FLOAT(0) NOT NULL COMMENT 'Error in pixel Y-coordinate.',
219        colErr FLOAT(0) NOT NULL COMMENT 'Error in pixel X-coordinate.',
220        cx DOUBLE NOT NULL COMMENT 'x-component of the (RA,Dec) unit vector',
221        cy DOUBLE NOT NULL COMMENT 'y-component of the (RA,Dec) unit vector',
222        cz DOUBLE NOT NULL COMMENT 'z-component of the (RA,Dec) unit vector',
223        taiMidPoint DOUBLE NOT NULL COMMENT 'If a DIASource corresponds to a single exposure, taiMidPoint represents tai time of the middle of exposure. For multiple exposures, this is middle of beginning-of-first-exposure to end-of-last-exposure',
224        taiRange FLOAT(0) NULL COMMENT 'If a DIASource corresponds to a single exposure, taiRange equals to exposure length. If DIASoure corresponds to multiple exposures, it taiRange equals to end-of-last-exposure minus beginning-of-first-exposure',
225        fwhmA FLOAT(0) NOT NULL COMMENT 'Size of the object along major axis (pixels).',
226        fwhmB FLOAT(0) NOT NULL COMMENT 'Size of the object along minor axis (pixels).',
227        fwhmTheta FLOAT(0) NOT NULL COMMENT 'Position angle of the major axis w.r.t. X-axis (measured in degrees).',
228        psfMag DOUBLE NOT NULL COMMENT 'PSF magnitude of the object',
229        psfMagErr FLOAT(0) NOT NULL COMMENT 'Uncertainty of PSF magnitude',
230        apMag DOUBLE NOT NULL COMMENT 'Aperture magnitude',
231        apMagErr FLOAT(0) NOT NULL COMMENT 'Uncertainty of aperture magnitude',
232        modelMag DOUBLE NOT NULL COMMENT 'model magnitude (adaptive 2D gauss)',
233        modelMagErr FLOAT(0) NOT NULL COMMENT 'Uncertainly of model magnitude.',
234        petroMag DOUBLE NULL COMMENT 'Petrosian flux',
235        petroMagErr FLOAT(0) NULL COMMENT 'Petrosian flux error',
236        apDia FLOAT(0) NULL COMMENT 'Diameter of aperture (pixels)',
237        snr FLOAT(0) NOT NULL COMMENT 'Signal-to-Noise Ratio for the PSF optimal filter.',
238        chi2 FLOAT(0) NOT NULL COMMENT 'Chi-square value for the PSF fit',
239        sky FLOAT(0) NULL,
240        skyErr FLOAT(0) NULL,
241        moment0 FLOAT(0) NULL COMMENT 'Sum of all flux of all pixels that belong to a source. PLACEHOLDER',
242        moment1_x FLOAT(0) NULL COMMENT 'Center of light - x component. PLACEHOLDER',
243        moment1_y FLOAT(0) NULL COMMENT 'Center of light - y component. PLACEHOLDER',
244        moment2_xx FLOAT(0) NULL COMMENT 'Standard deviation about center of light - xx component. PLACEHOLDER',
245        moment2_xy FLOAT(0) NULL COMMENT 'Standard deviation about center of light - xy component. PLACEHOLDER',
246        moment2_yy FLOAT(0) NULL COMMENT 'Standard deviation about center of light - yy component. PLACEHOLDER',
247        moment3_xxx FLOAT(0) NULL COMMENT 'Skewness of the profile - xxx component. PLACEHOLDER',
248        moment3_xxy FLOAT(0) NULL COMMENT 'Skewness of the profile - xxy component. PLACEHOLDER',
249        moment3_xyy FLOAT(0) NULL COMMENT 'Skewness of the profile - xyy component. PLACEHOLDER',
250        moment3_yyy FLOAT(0) NULL COMMENT 'Skewness of the profile - yyy component. PLACEHOLDER',
251        moment4_xxxx FLOAT(0) NULL COMMENT 'Kurtosis - xxxx component. PLACEHOLDER',
252        moment4_xxxy FLOAT(0) NULL COMMENT 'Kurtosis - xxxy component. PLACEHOLDER',
253        moment4_xxyy FLOAT(0) NULL COMMENT 'Kurtosis - xxyy component. PLACEHOLDER',
254        moment4_xyyy FLOAT(0) NULL COMMENT 'Kurtosis - xyyy component. PLACEHOLDER',
255        moment4_yyyy FLOAT(0) NULL COMMENT 'Kurtosis - yyyy component. PLACEHOLDER',
256        flag4association SMALLINT NULL COMMENT 'FIXME: likely we should use a Stage name here',
257        flag4detection SMALLINT NULL COMMENT 'FIXME: likely we should use a Stage name here',
258        flag4wcs SMALLINT NULL COMMENT 'Problem/special conditions indicator (Kem noted that these flags could include delta_sky, delta_PSF, ...). FIXME: likely we should use a Stage name here',
259        PRIMARY KEY (sourceId),
260        KEY (ampExposureId),
261        KEY (filterId),
262        KEY (movingObjectId),
263        KEY (objectId),
264        KEY (procHistoryId)
265) TYPE=MyISAM COMMENT='Table to store all sources from static (not DIA) photometry pipelines.';
266
267
268CREATE TABLE ObjectPhotoZ
269(
270        objectId BIGINT NOT NULL COMMENT 'This is of a corresponding object from the Object table.',
271        redshift FLOAT(0) NOT NULL COMMENT 'Photometric redshift.',
272        redshiftErr FLOAT(0) NOT NULL COMMENT 'Photometric redshift uncertainty.',
273        probability TINYINT NOT NULL DEFAULT 100 COMMENT 'Probability that given object has photo-z. 0-100. In %. Default 100%.',
274        photoZ1 FLOAT(0) NULL,
275        photoZ1Err FLOAT(0) NULL,
276        photoZ2 FLOAT(0) NULL,
277        photoZ2Err FLOAT(0) NULL,
278        photoZ1Outlier FLOAT(0) NULL,
279        photoZ2Outlier FLOAT(0) NULL,
280        KEY (objectId)
281)  COMMENT='Extension of the Object table for photo-z related information.';
282
283
284CREATE TABLE DIASource
285(
286        diaSourceId BIGINT NOT NULL COMMENT 'Unique id.',
287        ampExposureId BIGINT NOT NULL COMMENT 'Pointer to Amplifier table - amplifier where the source was measured.',
288        filterId TINYINT NOT NULL COMMENT 'Pointer to Filter table - filter used to take the Exposure where this source was measured.',
289        objectId BIGINT NULL COMMENT 'Pointer to Object table. Might be NULL (each DIASource will point to either MovingObject or Object)',
290        movingObjectId BIGINT NULL COMMENT 'Pointer to MovingObject table. Might be NULL (each DIASource will point to either MovingObject or Object)',
291        procHistoryId INTEGER NOT NULL COMMENT 'Pointer to ProcessingHistory table - an entry describing processing history of this source.',
292        scId INTEGER NOT NULL COMMENT 'Pointer to corresponding SourceClassification entry.',
293        ra DOUBLE NOT NULL COMMENT 'RA-coordinate of the source centroid (degrees) Need to support accuracy ~ 0.0001 arcsec.',
294        decl DOUBLE NOT NULL COMMENT 'Dec coordinate of the source centroid (degrees). Need to support accuracy ~0.0001 arcsec.',
295        __zoneId_placeholder INTEGER NULL COMMENT 'FIXME: placeholder',
296        raErr4detection FLOAT(0) NOT NULL COMMENT 'Error in centroid RA coordinate (miliarcsec) coming from Detection Pipeline [FIXME, maybe use Stage name here?].',
297        decErr4detection FLOAT(0) NOT NULL COMMENT 'Error in centroid Dec coordinate (miliarcsec) coming from Detection Pipeline [FIXME, maybe use Stage name here?].',
298        raErr4wcs FLOAT(0) NULL COMMENT 'Error in centroid RA coordinate (miliarcsec) coming from WCS Stage.',
299        decErr4wcs FLOAT(0) NULL COMMENT 'Error in centroid Dec coordinate (miliarcsec) coming from WCS Stage.',
300        row DOUBLE NOT NULL COMMENT 'Pixel coordinate (Y) of the source centroid.',
301        col DOUBLE NOT NULL COMMENT 'Pixel coordinate (X) of the source centroid.',
302        rowErr FLOAT(0) NOT NULL COMMENT 'Error in pixel Y-coordinate.',
303        colErr FLOAT(0) NOT NULL COMMENT 'Error in pixel X-coordinate.',
304        cx DOUBLE NOT NULL COMMENT 'x-component of the (RA,Dec) unit vector',
305        cy DOUBLE NOT NULL COMMENT 'y-component of the (RA,Dec) unit vector',
306        cz DOUBLE NOT NULL COMMENT 'z-component of the (RA,Dec) unit vector',
307        taiMidPoint DOUBLE NOT NULL COMMENT 'If a DIASource corresponds to a single exposure, taiMidPoint represents tai time of the middle of exposure. For multiple exposures, this is middle of beginning-of-first-exposure to end-of-last-exposure.',
308        taiRange FLOAT(0) NOT NULL COMMENT 'If a DIASource corresponds to a single exposure, taiRange equals to exposure length. If DIASoure corresponds to multiple exposures, it taiRange equals to end-of-last-exposure minus beginning-of-first-exposure.',
309        fwhmA FLOAT(0) NOT NULL COMMENT 'Size of the object along major axis (pixels).',
310        fwhmB FLOAT(0) NOT NULL COMMENT 'Size of the object along minor axis (pixels).',
311        fwhmTheta FLOAT(0) NOT NULL COMMENT 'Position angle of the major axis w.r.t. X-axis (measured in degrees).',
312        flux FLOAT(0) NOT NULL COMMENT 'Measured DIA flux for the source (ADUs). Range is just a guesstimate, based on SM values [FIXME]',
313        fluxErr FLOAT(0) NOT NULL COMMENT 'Error of the measured flux (ADUs). Range is just a guesstimate, based on SM values [FIXME]',
314        psfMag DOUBLE NOT NULL COMMENT 'PSF magnitude of the object',
315        psfMagErr FLOAT(0) NOT NULL COMMENT 'Uncertainty of PSF magnitude',
316        apMag DOUBLE NOT NULL COMMENT 'Aperture magnitude',
317        apMagErr FLOAT(0) NOT NULL COMMENT 'Uncertainty of aperture magnitude',
318        modelMag DOUBLE NOT NULL COMMENT 'model magnitude (adaptive 2D gauss)',
319        modelMagErr FLOAT(0) NULL COMMENT 'Uncertainly of model magnitude.',
320        apDia FLOAT(0) NULL COMMENT 'Diameter of aperture (pixels)',
321        Ixx FLOAT(0) NULL COMMENT 'Adaptive second moment',
322        IxxErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty',
323        Iyy FLOAT(0) NULL COMMENT 'Adaptive second moment',
324        IyyErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty',
325        Ixy FLOAT(0) NULL COMMENT 'Adaptive second moment',
326        IxyErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty',
327        snr FLOAT(0) NOT NULL COMMENT 'Signal-to-Noise ratio',
328        chi2 FLOAT(0) NOT NULL COMMENT 'Chi-square value for the PSF fit',
329        flag4association SMALLINT NULL COMMENT 'Problem/special conditions indicator (Kem noted that these flags could include delta_sky, delta_PSF, ...). FIXME: likely we should use a Stage name here',
330        flag4detection SMALLINT NULL COMMENT 'Problem/special conditions indicator (Kem noted that these flags could include delta_sky, delta_PSF, ...). ',
331        flag4wcs SMALLINT NULL COMMENT 'Problem/special conditions indicator (Kem noted that these flags could include delta_sky, delta_PSF, ...). ',
332        PRIMARY KEY (diaSourceId),
333        KEY (ampExposureId),
334        KEY (filterId),
335        KEY (movingObjectId),
336        KEY (objectId),
337        KEY (procHistoryId),
338        KEY (scId)
339) TYPE=MyISAM COMMENT='Table to store all Difference Image Analysis (DIA) Sources.';
340
341
342CREATE TABLE Alert
343(
344        alertId INTEGER NOT NULL DEFAULT 0,
345        ampExposureId BIGINT NOT NULL COMMENT 'Pointer to AmpExposure table.',
346        objectId BIGINT NOT NULL COMMENT 'Id of object associated with given alert.',
347        timeGenerated DATETIME NOT NULL COMMENT 'Date/time when alert was generated.',
348        imagePStampURL VARCHAR(255) NULL COMMENT 'Logical URL describing where the image postamp associated with the alert is located.',
349        templatePStampURL VARCHAR(255) NULL COMMENT 'Logical URL of the postagestamp of the template image related to given alert.',
350        alertURL VARCHAR(255) NULL COMMENT 'Logical URL to the actual alert sent.',
351        __voEventId BIGINT NULL COMMENT 'FIXME. Some sort of pointer to voEvent. Placeholder. Also, not sure if type is correct.',
352        PRIMARY KEY (alertId),
353        KEY (objectId),
354        INDEX idx_Alert_timeGenerated (timeGenerated ASC),
355        KEY (ampExposureId)
356) TYPE=MyISAM COMMENT='Table to store generated alerts.';
357
358
359CREATE TABLE Science_CCD_Exposure
360(
361        ccdExposureId BIGINT NOT NULL COMMENT 'Pointer to raw exposure.',
362        exposureId INTEGER NOT NULL COMMENT 'Pointer to Exposure table. This also identifies Calibration_FPA_Exposure used to calibrated this exposure.',
363        sceId INTEGER NOT NULL COMMENT 'Pointer to science calibrated exposure.',
364        filterId TINYINT NOT NULL COMMENT 'Pointer to filter.',
365        equinox FLOAT(0) NOT NULL COMMENT 'Equinox of World Coordinate System.',
366        url VARCHAR(255) NOT NULL COMMENT 'Logical URL to the actual calibrated image.',
367        ctype1 VARCHAR(20) NOT NULL COMMENT 'Coordinate projection type, axis 1.',
368        ctype2 VARCHAR(20) NOT NULL COMMENT 'Coordinate projection type, axis 2.',
369        crpix1 FLOAT(0) NOT NULL COMMENT 'Coordinate reference pixel, axis 1.',
370        crpix2 FLOAT(0) NOT NULL COMMENT 'Coordinate reference pixel, axis 2.',
371        crval1 DOUBLE NOT NULL COMMENT 'Coordinate value 1 @reference pixel.',
372        crval2 DOUBLE NOT NULL COMMENT 'Coordinate value 2 @reference pixel.',
373        cd1_1 DOUBLE NOT NULL COMMENT 'First derivative of coordinate 1 w.r.t. axis 1.',
374        cd2_1 DOUBLE NOT NULL COMMENT 'First derivative of coordinate 2 w.r.t. axis 1.',
375        cd1_2 DOUBLE NOT NULL COMMENT 'First derivative of coordinate 1 w.r.t. axis 2.',
376        cd2_2 DOUBLE NOT NULL COMMENT 'First derivative of coordinate 2 w.r.t. axis 2.',
377        dateObs DATETIME NOT NULL COMMENT 'Date/Time of observation start (UTC).',
378        expTime FLOAT(0) NOT NULL COMMENT 'Duration of exposure.',
379        photoFlam FLOAT(0) NOT NULL COMMENT 'Inverse sensitivity.',
380        photoZP FLOAT(0) NOT NULL COMMENT 'System photometric zero-point.',
381        nCombine INTEGER NOT NULL DEFAULT 1 COMMENT 'Number of images co-added to create a deeper image',
382        PRIMARY KEY (ccdExposureId),
383        KEY (ccdExposureId)
384) ;
385
386
387CREATE TABLE Science_Amp_Exposure
388(
389        ampExposureId BIGINT NOT NULL,
390        ccdExposureId INTEGER NOT NULL,
391        PRIMARY KEY (ampExposureId),
392        KEY (ampExposureId),
393        KEY (ccdExposureId)
394) ;
395
396
397CREATE TABLE Calibration_Amp_Exposure
398(
399        ccdExposureId INTEGER NULL COMMENT 'Pointer to CCD_Exposure.',
400        ampExposureId BIGINT NOT NULL,
401        PRIMARY KEY (ampExposureId),
402        KEY (ccdExposureId),
403        KEY (ampExposureId)
404) ;
405
406
407CREATE TABLE _Source2Object
408(
409        objectId BIGINT NOT NULL COMMENT 'Id of the object - pointer to a row in the Object table',
410        sourceId BIGINT NOT NULL COMMENT 'Id of source - pointer to a row in the Source table',
411        splitPercentage TINYINT NOT NULL COMMENT 'percentage of the split (all for a given source must add up to 100%',
412        INDEX idx_Source2Object_objectId (objectId ASC),
413        INDEX idx_Source2Object_sourceId (sourceId ASC)
414)  COMMENT='Table used to store mapping Source --> Object for sources that belong to more than one object (Objects that "split"). If a source corresponds to only one object, objectId is used. See http://lsstdev.ncsa.uiuc.edu:8100/trac/wiki/dbObjectSplits for further details.';
415
416
417CREATE TABLE _Source2Amp_Exposure
418(
419        sourceId BIGINT NOT NULL COMMENT 'Pointer to entry in Source table.',
420        ampExposureId BIGINT NOT NULL COMMENT 'Pointer to enty in AmpExposure table.',
421        KEY (ampExposureId),
422        KEY (sourceId)
423)  COMMENT='Source --> AmpExposures';
424
425
426CREATE TABLE aux_Science_FPA_Exposure
427(
428        dummy INTEGER NULL
429) ;
430
431
432CREATE TABLE Object
433(
434        objectId BIGINT NOT NULL COMMENT 'Unique id.',
435        procHistoryId INTEGER NOT NULL COMMENT 'Pointer to ProcessingHistory table.',
436        ra DOUBLE NOT NULL COMMENT 'RA-coordinate of the object (degrees). Weighted center of light across all filters. Need to support accuracy ~0.0001 arcsec.',
437        decl DOUBLE NOT NULL COMMENT 'Dec-coordinate of the object (degrees). Weighted center of light across all filters. Need to support accuracy ~0.0001 arcsec',
438        raErr FLOAT(0) NOT NULL,
439        declErr FLOAT(0) NOT NULL,
440        muRa DOUBLE NULL COMMENT 'derived proper motion, mu_alpha*cos(Dec) (measured in arcsec/yr)',
441        muDecl DOUBLE NULL COMMENT 'derived proper motion, mu_delta (measured in arcsec/yr)',
442        muRaErr FLOAT(0) NULL COMMENT 'Error in ra proper motion',
443        muDeclErr FLOAT(0) NULL COMMENT 'Error in Decl proper motion',
444        parallax FLOAT(0) NULL COMMENT 'derived parallax for the object',
445        parallaxErr FLOAT(0) NULL COMMENT 'parallax error',
446        earliestObsTime DATETIME NULL COMMENT 'first observation time',
447        latestObsTime DATETIME NULL COMMENT 'last observation time',
448        ugColor DOUBLE NULL COMMENT 'Precalculated color (difference between u and g).',
449        grColor DOUBLE NULL COMMENT 'Precalculated color (difference between g and r).',
450        riColor DOUBLE NULL COMMENT 'Precalculated color (difference between r and i).',
451        izColor DOUBLE NULL COMMENT 'Precalculated color (difference between i and z).',
452        zyColor DOUBLE NULL COMMENT 'Precalculated color (difference between z and y).',
453        cx DOUBLE NOT NULL COMMENT 'x-component of the (RA,Dec) unit vector',
454        cxErr DOUBLE NOT NULL,
455        cy DOUBLE NOT NULL COMMENT 'z-component of the (RA,Dec) unit vector',
456        cyErr DOUBLE NOT NULL,
457        cz DOUBLE NOT NULL COMMENT 'z-component of the (RA,Dec) unit vector',
458        czErr DOUBLE NOT NULL,
459        flag4stage1 INTEGER NULL COMMENT 'Problem/special condition flag reported by one stage. FIXME: replace with real Stage name',
460        flag4stage2 INTEGER NULL COMMENT 'Problem/special condition flag reported by one stage. FIXME: replace with real Stage name',
461        flag4stage3 INTEGER NULL COMMENT 'Problem/special condition flag reported by one stage. FIXME: replace with real Stage name',
462        isProvisional BOOL NOT NULL DEFAULT FALSE COMMENT 'If this is set to true it indicates that the object was created at the base camp. If set to false, it means it was created by Deep Detection.',
463        uMag DOUBLE NULL COMMENT 'u-magnitude (weighted average)',
464        uMagErr FLOAT(0) NULL COMMENT 'u-magnitude error',
465        uPetroMag DOUBLE NULL COMMENT 'Petrosian flux for u filter',
466        uPetroMagErr FLOAT(0) NULL COMMENT 'Petrosian flux error for u filter',
467        uApMag DOUBLE NULL COMMENT 'aperture magnitude for u filter',
468        uApMagErr FLOAT(0) NULL COMMENT 'aperture magnitude error for u filter',
469        uErrA FLOAT(0) NULL COMMENT 'Large dimension of the position error ellipse, assuming gaussian scatter (arcsec). For u filter',
470        uErrB FLOAT(0) NULL COMMENT 'Small dimension of the position error ellipse, assuming gaussian scatter (arcsec).  For u filter',
471        uErrTheta FLOAT(0) NULL COMMENT 'Orientation of the position error ellipse (degrees). For u filter',
472        uNumObs INTEGER NULL COMMENT 'Number of measurements in the lightcurve for u filter.',
473        uVarProb SMALLINT NULL COMMENT 'Probability of variability in % (100% = variable object) for u filter. Note: large photometric errors do not necessarily mean variability.',
474        uAmplitude FLOAT(0) NULL COMMENT 'Characteristic magnitude scale of the flux variations for u filter',
475        uPeriod FLOAT(0) NULL COMMENT 'Period of flux variations (if regular) for u filter',
476        uIxx FLOAT(0) NULL COMMENT 'Adaptive second moment for u filter',
477        uIxxErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty for u filter',
478        uIyy FLOAT(0) NULL COMMENT 'Adaptive second moment for u filter',
479        uIyyErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty for u filter',
480        uIxy FLOAT(0) NULL COMMENT 'Adaptive second moment for u fiter',
481        uIxyErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty for u filter',
482        uTimescale FLOAT(0) NULL COMMENT 'Characteristic timescale of flux variations (measured in days). This is to complement period for variables without a well-defined period. LSST images have sampling frequency of ~0.1Hz. For u filter',
483        gMag DOUBLE NULL COMMENT 'g-magnitude (weighted average)',
484        gMagErr FLOAT(0) NULL COMMENT 'g-magnitude error',
485        gPetroMag DOUBLE NULL COMMENT 'Petrosian flux for g filter',
486        gPetroMagErr FLOAT(0) NULL COMMENT 'Petrosian flux error filter for g filter',
487        gApMag DOUBLE NULL COMMENT 'aperture magnitude for g filter',
488        gApMagErr FLOAT(0) NULL COMMENT 'aperture magnitude error for g filter',
489        gErrA FLOAT(0) NULL,
490        gErrB FLOAT(0) NULL,
491        gErrTheta FLOAT(0) NULL,
492        gNumObs INTEGER NULL,
493        gVarProb SMALLINT NULL COMMENT 'Probability of variability in % (100% = variable object) for g filter. Note: large photometric errors do not necessarily mean variability.',
494        gAmplitude FLOAT(0) NULL,
495        gPeriod FLOAT(0) NULL,
496        gIxx FLOAT(0) NULL COMMENT 'Adaptive second moment for g filter',
497        gIxxErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty for g filter',
498        gIyy FLOAT(0) NULL COMMENT 'Adaptive second moment for g filter',
499        gIyyErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty for g filter',
500        gIxy FLOAT(0) NULL COMMENT 'Adaptive second moment for g filter',
501        gIxyErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty for g filter',
502        gTimescale FLOAT(0) NULL,
503        rMag DOUBLE NULL COMMENT 'r-magnitude (weighted average)',
504        rMagErr FLOAT(0) NULL COMMENT 'r-magnitude error',
505        rPetroMag DOUBLE NULL COMMENT 'Petrosian flux for r filter',
506        rPetroMagErr FLOAT(0) NULL COMMENT 'Petrosian flux error for r filter',
507        rErrA FLOAT(0) NULL,
508        rErrB FLOAT(0) NULL,
509        rErrTheta FLOAT(0) NULL,
510        rNumObs INTEGER NULL,
511        rVarProb SMALLINT NULL COMMENT 'Probability of variability in % (100% = variable object) for r filter. Note: large photometric errors do not necessarily mean variability.',
512        rAmplitude FLOAT(0) NULL,
513        rPeriod FLOAT(0) NULL,
514        rIxx FLOAT(0) NULL COMMENT 'Adaptive second moment for r filter',
515        rIxxErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty for r filter',
516        rIyy FLOAT(0) NULL COMMENT 'Adaptive second moment for r filter',
517        rIyyErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty for r filter',
518        rIxy FLOAT(0) NULL COMMENT 'Adaptive second moment for r filter',
519        rIxyErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty for r filter',
520        rTimescale FLOAT(0) NULL,
521        iMag DOUBLE NULL COMMENT 'i-magnitude (weighted average)',
522        iMagErr FLOAT(0) NULL COMMENT 'i-magnitude error',
523        iPetroMag DOUBLE NULL COMMENT 'Petrosian flux for i filter',
524        iPetroMagErr FLOAT(0) NULL COMMENT 'Petrosian flux error for i filter',
525        iErrA FLOAT(0) NULL,
526        iErrB FLOAT(0) NULL,
527        iErrTheta FLOAT(0) NULL,
528        iNumObs INTEGER NULL,
529        iVarProb SMALLINT NULL COMMENT 'Probability of variability in % (100% = variable object) for i filter. Note: large photometric errors do not necessarily mean variability.',
530        iAmplitude FLOAT(0) NULL,
531        iPeriod FLOAT(0) NULL,
532        iIxx FLOAT(0) NULL COMMENT 'Adaptive second moment for i filter',
533        iIxxErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty for i filter',
534        iIyy FLOAT(0) NULL COMMENT 'Adaptive second moment for i filter',
535        iIyyErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty for i filter',
536        iIxy FLOAT(0) NULL COMMENT 'Adaptive second moment for i filter',
537        iIxyErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty for i filter',
538        iTimescale FLOAT(0) NULL,
539        zMag DOUBLE NULL COMMENT 'z-magnitude (weighted average)',
540        zMagErr FLOAT(0) NULL COMMENT 'z-magnitude error',
541        zPetroMag DOUBLE NULL COMMENT 'Petrosian flux for z filter',
542        zPetroMagErr FLOAT(0) NULL COMMENT 'Petrosian flux error for z filter',
543        zErrA FLOAT(0) NULL,
544        zErrB FLOAT(0) NULL,
545        zErrTheta FLOAT(0) NULL,
546        zNumObs INTEGER NULL,
547        zVarProb SMALLINT NULL COMMENT 'Probability of variability in % (100% = variable object) for z filter. Note: large photometric errors do not necessarily mean variability.',
548        zAmplitude FLOAT(0) NULL,
549        zPeriod FLOAT(0) NULL,
550        zIxx FLOAT(0) NULL COMMENT 'Adaptive second moment for z filter',
551        zIxxErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty for z filter',
552        zIyy FLOAT(0) NULL COMMENT 'Adaptive second moment for z filter',
553        zIyyErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty for z filter',
554        zIxy FLOAT(0) NULL COMMENT 'Adaptive second moment for z filter',
555        zIxyErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty for z filter',
556        zTimescale FLOAT(0) NULL,
557        yMag DOUBLE NULL COMMENT 'y-magnitude (weighted average)',
558        yMagErr FLOAT(0) NULL COMMENT 'y-magnitude error',
559        yPetroMag DOUBLE NULL COMMENT 'Petrosian flux for y filter',
560        yPetroMagErr DOUBLE NULL COMMENT 'Petrosian flux error for y filter',
561        yErrA FLOAT(0) NULL,
562        yErrB FLOAT(0) NULL,
563        yErrTheta FLOAT(0) NULL,
564        yNumObs INTEGER NULL,
565        yVarProb SMALLINT NULL COMMENT 'Probability of variability in % (100% = variable object) for y filter. Note: large photometric errors do not necessarily mean variability.',
566        yAmplitude FLOAT(0) NULL,
567        yPeriod FLOAT(0) NULL,
568        yIxx FLOAT(0) NULL COMMENT 'Adaptive second moment for y filter',
569        yIxxErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty for y filter',
570        yIyy FLOAT(0) NULL COMMENT 'Adaptive second moment for y filter',
571        yIyyErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty for y filter',
572        yIxy FLOAT(0) NULL COMMENT 'Adaptive second moment for y filter',
573        yIxyErr FLOAT(0) NULL COMMENT 'Adaptive second moment uncertainty for y filter',
574        yTimescale FLOAT(0) NULL,
575        uScalegram01 FLOAT(0) NULL COMMENT '"Scalegram": time series as the average of the squares of the wavelet coefficients at a given scale. See Scargel et al 1993 for more details.',
576        uScalegram02 FLOAT(0) NULL,
577        uScalegram03 FLOAT(0) NULL,
578        uScalegram04 FLOAT(0) NULL,
579        uScalegram05 FLOAT(0) NULL,
580        uScalegram06 FLOAT(0) NULL,
581        uScalegram07 FLOAT(0) NULL,
582        uScalegram08 FLOAT(0) NULL,
583        uScalegram09 FLOAT(0) NULL,
584        uScalegram10 FLOAT(0) NULL,
585        uScalegram11 FLOAT(0) NULL,
586        uScalegram12 FLOAT(0) NULL,
587        uScalegram13 FLOAT(0) NULL,
588        uScalegram14 FLOAT(0) NULL,
589        uScalegram15 FLOAT(0) NULL,
590        uScalegram16 FLOAT(0) NULL,
591        uScalegram17 FLOAT(0) NULL,
592        uScalegram18 FLOAT(0) NULL,
593        uScalegram19 FLOAT(0) NULL,
594        uScalegram20 FLOAT(0) NULL,
595        uScalegram21 FLOAT(0) NULL,
596        uScalegram22 FLOAT(0) NULL,
597        uScalegram23 FLOAT(0) NULL,
598        uScalegram24 FLOAT(0) NULL,
599        uScalegram25 FLOAT(0) NULL,
600        gScalegram01 FLOAT(0) NULL,
601        gScalegram02 FLOAT(0) NULL,
602        gScalegram03 FLOAT(0) NULL,
603        gScalegram04 FLOAT(0) NULL,
604        gScalegram05 FLOAT(0) NULL,
605        gScalegram06 FLOAT(0) NULL,
606        gScalegram07 FLOAT(0) NULL,
607        gScalegram08 FLOAT(0) NULL,
608        gScalegram09 FLOAT(0) NULL,
609        gScalegram10 FLOAT(0) NULL,
610        gScalegram11 FLOAT(0) NULL,
611        gScalegram12 FLOAT(0) NULL,
612        gScalegram13 FLOAT(0) NULL,
613        gScalegram14 FLOAT(0) NULL,
614        gScalegram15 FLOAT(0) NULL,
615        gScalegram16 FLOAT(0) NULL,
616        gScalegram17 FLOAT(0) NULL,
617        gScalegram18 FLOAT(0) NULL,
618        gScalegram19 FLOAT(0) NULL,
619        gScalegram20 FLOAT(0) NULL,
620        gScalegram21 FLOAT(0) NULL,
621        gScalegram22 FLOAT(0) NULL,
622        gScalegram23 FLOAT(0) NULL,
623        gScalegram24 FLOAT(0) NULL,
624        gScalegram25 FLOAT(0) NULL,
625        rScalegram01 FLOAT(0) NULL,
626        rScalegram02 FLOAT(0) NULL,
627        rScalegram03 FLOAT(0) NULL,
628        rScalegram04 FLOAT(0) NULL,
629        rScalegram05 FLOAT(0) NULL,
630        rScalegram06 FLOAT(0) NULL,
631        rScalegram07 FLOAT(0) NULL,
632        rScalegram08 FLOAT(0) NULL,
633        rScalegram09 FLOAT(0) NULL,
634        rScalegram10 FLOAT(0) NULL,
635        rScalegram11 FLOAT(0) NULL,
636        rScalegram12 FLOAT(0) NULL,
637        rScalegram13 FLOAT(0) NULL,
638        rScalegram14 FLOAT(0) NULL,
639        rScalegram15 FLOAT(0) NULL,
640        rScalegram16 FLOAT(0) NULL,
641        rScalegram17 FLOAT(0) NULL,
642        rScalegram18 FLOAT(0) NULL,
643        rScalegram19 FLOAT(0) NULL,
644        rScalegram20 FLOAT(0) NULL,
645        rScalegram21 FLOAT(0) NULL,
646        rScalegram22 FLOAT(0) NULL,
647        rScalegram23 FLOAT(0) NULL,
648        rScalegram24 FLOAT(0) NULL,
649        rScalegram25 FLOAT(0) NULL,
650        iScalegram01 FLOAT(0) NULL,
651        iScalegram02 FLOAT(0) NULL,
652        iScalegram03 FLOAT(0) NULL,
653        iScalegram04 FLOAT(0) NULL,
654        iScalegram05 FLOAT(0) NULL,
655        iScalegram06 FLOAT(0) NULL,
656        iScalegram07 FLOAT(0) NULL,
657        iScalegram08 FLOAT(0) NULL,
658        iScalegram09 FLOAT(0) NULL,
659        iScalegram10 FLOAT(0) NULL,
660        iScalegram11 FLOAT(0) NULL,
661        iScalegram12 FLOAT(0) NULL,
662        iScalegram13 FLOAT(0) NULL,
663        iScalegram14 FLOAT(0) NULL,
664        iScalegram15 FLOAT(0) NULL,
665        iScalegram16 FLOAT(0) NULL,
666        iScalegram17 FLOAT(0) NULL,
667        iScalegram18 FLOAT(0) NULL,
668        iScalegram19 FLOAT(0) NULL,
669        iScalegram20 FLOAT(0) NULL,
670        iScalegram21 FLOAT(0) NULL,
671        iScalegram22 FLOAT(0) NULL,
672        iScalegram23 FLOAT(0) NULL,
673        iScalegram24 FLOAT(0) NULL,
674        iScalegram25 FLOAT(0) NULL,
675        zScalegram01 FLOAT(0) NULL,
676        zScalegram02 FLOAT(0) NULL,
677        zScalegram03 FLOAT(0) NULL,
678        zScalegram04 FLOAT(0) NULL,
679        zScalegram05 FLOAT(0) NULL,
680        zScalegram06 FLOAT(0) NULL,
681        zScalegram07 FLOAT(0) NULL,
682        zScalegram08 FLOAT(0) NULL,
683        zScalegram09 FLOAT(0) NULL,
684        zScalegram10 FLOAT(0) NULL,
685        zScalegram11 FLOAT(0) NULL,
686        zScalegram12 FLOAT(0) NULL,
687        zScalegram13 FLOAT(0) NULL,
688        zScalegram14 FLOAT(0) NULL,
689        zScalegram15 FLOAT(0) NULL,
690        zScalegram16 FLOAT(0) NULL,
691        zScalegram17 FLOAT(0) NULL,
692        zScalegram18 FLOAT(0) NULL,
693        zScalegram19 FLOAT(0) NULL,
694        zScalegram20 FLOAT(0) NULL,
695        zScalegram21 FLOAT(0) NULL,
696        zScalegram22 FLOAT(0) NULL,
697        zScalegram23 FLOAT(0) NULL,
698        zScalegram24 FLOAT(0) NULL,
699        zScalegram25 FLOAT(0) NULL,
700        yScalegram01 FLOAT(0) NULL,
701        yScalegram02 FLOAT(0) NULL,
702        yScalegram03 FLOAT(0) NULL,
703        yScalegram04 FLOAT(0) NULL,
704        yScalegram05 FLOAT(0) NULL,
705        yScalegram06 FLOAT(0) NULL,
706        yScalegram07 FLOAT(0) NULL,
707        yScalegram08 FLOAT(0) NULL,
708        yScalegram09 FLOAT(0) NULL,
709        yScalegram10 FLOAT(0) NULL,
710        yScalegram11 FLOAT(0) NULL,
711        yScalegram12 FLOAT(0) NULL,
712        yScalegram13 FLOAT(0) NULL,
713        yScalegram14 FLOAT(0) NULL,
714        yScalegram15 FLOAT(0) NULL,
715        yScalegram16 FLOAT(0) NULL,
716        yScalegram17 FLOAT(0) NULL,
717        yScalegram18 FLOAT(0) NULL,
718        yScalegram19 FLOAT(0) NULL,
719        yScalegram20 FLOAT(0) NULL,
720        yScalegram21 FLOAT(0) NULL,
721        yScalegram22 FLOAT(0) NULL,
722        yScalegram23 FLOAT(0) NULL,
723        yScalegram24 FLOAT(0) NULL,
724        yScalegram25 FLOAT(0) NULL,
725        primaryPeriod FLOAT(0) NULL COMMENT 'period that represent periods for all filters.',
726        primaryPeriodErr FLOAT(0) NULL,
727        rApMag DOUBLE NULL COMMENT 'aperture magnitude for r filter',
728        iApMag DOUBLE NULL COMMENT 'aperture magnitude for i filter',
729        zApMag DOUBLE NULL COMMENT 'aperture magnitude for z filter',
730        yApMag DOUBLE NULL COMMENT 'aperture magnitude for y filter',
731        rApMagErr FLOAT(0) NULL COMMENT 'aperture magnitude error for r filter',
732        iApMagErr FLOAT(0) NULL COMMENT 'aperture magnitude error for i filter',
733        zApMagErr FLOAT(0) NULL COMMENT 'aperture magnitude error for z filter',
734        yApMagErr FLOAT(0) NULL COMMENT 'aperture magnitude error for y filter',
735        uPeriodErr FLOAT(0) NULL,
736        gPeriodErr FLOAT(0) NULL,
737        rPeriodErr FLOAT(0) NULL,
738        iPeriodErr FLOAT(0) NULL,
739        zPeriodErr FLOAT(0) NULL,
740        yPeriodErr FLOAT(0) NULL,
741        zone INTEGER NULL COMMENT 'zone is an index to speed up spatial queries.',
742        PRIMARY KEY (objectId),
743        INDEX idx_Object_ugColor (ugColor ASC),
744        INDEX idx_Object_grColor (grColor ASC),
745        INDEX idx_Object_riColor (riColor ASC),
746        INDEX idx_Object_izColor (izColor ASC),
747        INDEX idx_Object_zyColor (zyColor ASC),
748        INDEX idx_Object_latestObsTime (latestObsTime ASC),
749        KEY (procHistoryId)
750) TYPE=MyISAM COMMENT='Description of the multi-epoch static object. (Kem: do we link Object and DIAObject tables? Right now it''s done through the source tables)';
751
752
753CREATE TABLE MovingObject
754(
755        movingObjectId BIGINT NOT NULL COMMENT 'Unique id.',
756        procHistoryId INTEGER NOT NULL COMMENT 'Pointer to ProcessingHistory table.',
757        a FLOAT(0) NULL COMMENT 'semi-major axis of the orbit (AU)',
758        incl FLOAT(0) NULL COMMENT 'inclination of the orbit (degrees)',
759        e FLOAT(0) NULL COMMENT 'eccentricity of the orbit',
760        periTAI FLOAT(0) NULL COMMENT 'TAI of the perihelion passage (comets)',
761        periDist FLOAT(0) NULL COMMENT 'Perihelion distance (AU)',
762        omega FLOAT(0) NULL COMMENT 'Argument of perihelion',
763        node FLOAT(0) NULL COMMENT 'Longitude of the ascending node',
764        meanAnom FLOAT(0) NULL COMMENT 'Mean anomaly of the orbit',
765        qual FLOAT(0) NULL COMMENT 'measure of the accuracy of the derived orbit, classification, etc. The field is a PLACEHOLDER, can be multiple floats.',
766        uMag DOUBLE NOT NULL COMMENT 'u-magnitude (weighted average)',
767        uMagErr FLOAT(0) NOT NULL COMMENT 'u-magnitude error',
768        uAmplitude FLOAT(0) NULL COMMENT 'Characteristic magnitude scale of the flux variations for u filter',
769        uPeriod FLOAT(0) NULL COMMENT 'Period of flux variations (if regular) for u filter',
770        gMag DOUBLE NOT NULL COMMENT 'g-magnitude (weighted average)',
771        gMagErr FLOAT(0) NOT NULL COMMENT 'g-magnitude error',
772        gAmplitude FLOAT(0) NULL COMMENT 'Characteristic magnitude scale of the flux variations for g filter',
773        gPeriod FLOAT(0) NULL COMMENT 'Period of flux variations (if regular) for g filter',
774        rMag DOUBLE NOT NULL COMMENT 'r-magnitude (weighted average)',
775        rMagErr FLOAT(0) NOT NULL COMMENT 'r-magnitude error',
776        rAmplitude FLOAT(0) NULL COMMENT 'Characteristic magnitude scale of the flux variations for r filter',
777        rPeriod FLOAT(0) NULL COMMENT 'Period of flux variations (if regular) for r filter',
778        iMag DOUBLE NOT NULL COMMENT 'i-magnitude (weighted average)',
779        iMagErr FLOAT(0) NOT NULL COMMENT 'i-magnitude error',
780        iAmplitude FLOAT(0) NULL COMMENT 'Characteristic magnitude scale of the flux variations for i filter',
781        iPeriod FLOAT(0) NULL COMMENT 'Period of flux variations (if regular) for i filter',
782        zMag DOUBLE NOT NULL COMMENT 'z-magnitude (weighted average)',
783        zMagErr FLOAT(0) NOT NULL COMMENT 'z-magnitude error',
784        zAmplitude FLOAT(0) NULL COMMENT 'Characteristic magnitude scale of the flux variations for z filter',
785        zPeriod FLOAT(0) NULL COMMENT 'Period of flux variations (if regular) for z filter',
786        yMag DOUBLE NOT NULL COMMENT 'y-magnitude (weighted average)',
787        yMagErr FLOAT(0) NOT NULL COMMENT 'y-magnitude error',
788        yAmplitude FLOAT(0) NULL COMMENT 'Characteristic magnitude scale of the flux variations for y filter',
789        yPeriod FLOAT(0) NULL COMMENT 'Period of flux variations (if regular) for y filter',
790        flag INTEGER NULL COMMENT 'Problem/special condition flag.',
791        PRIMARY KEY (movingObjectId),
792        KEY (procHistoryId)
793)  COMMENT='Table to store description of the Solar System (moving) Objects. ';
794
795
796CREATE TABLE Raw_CCD_Exposure
797(
798        ccdExposureId BIGINT NOT NULL COMMENT 'Unique id',
799        exposureId INTEGER NOT NULL COMMENT 'Pointer to the Exposure that this CCDExposure belongs to',
800        procHistoryId INTEGER NULL COMMENT 'Pointer to ProcessingHistory. Valid if all pieces processed with the same processing history (all AmpExposures). If different processing histories used, then NULL',
801        filterId TINYINT NOT NULL,
802        visitId INTEGER NULL,
803        ra DOUBLE NOT NULL COMMENT 'Right Ascension of aperture center.',
804        decl DOUBLE NOT NULL COMMENT 'Declination of aperture center.',
805        equinox FLOAT(0) NOT NULL COMMENT 'Equinox of World Coordinate System.',
806        url VARCHAR(255) NOT NULL COMMENT 'Logical URL to the corresponding image file.',
807        ctype1 VARCHAR(20) NOT NULL COMMENT 'Coordinate projection type, axis 1.',
808        ctype2 VARCHAR(20) NOT NULL COMMENT 'Coordinate projection type, axis 2.',
809        crpix1 FLOAT(0) NOT NULL COMMENT 'Coordinate reference pixel, axis 1.',
810        crpix2 FLOAT(0) NOT NULL COMMENT 'Coordinate reference pixel, axis 2.',
811        crval1 DOUBLE NOT NULL COMMENT 'Coordinate value 1 @reference pixel.',
812        crval2 DOUBLE NOT NULL COMMENT 'Coordinate value 2 @reference pixel.',
813        cd11 DOUBLE NOT NULL COMMENT 'First derivative of coordinate 1 w.r.t. axis 1.',
814        cd21 DOUBLE NOT NULL COMMENT 'First derivative of coordinate 2 w.r.t. axis 1.',
815        cd12 DOUBLE NOT NULL COMMENT 'First derivative of coordinate 1 w.r.t. axis 2.',
816        cd22 DOUBLE NOT NULL COMMENT 'First derivative of coordinate 2 w.r.t. axis 2.',
817        dateObs DATETIME NOT NULL COMMENT 'Date/Time of observation start (UTC).',
818        taiObs DATETIME NULL COMMENT 'TAI-OBS = UTC + offset. Offset = 32 s from  1/1/1999 to 1/1/2006, = 33 s after 1/1/2006.',
819        mjdObs DOUBLE NULL COMMENT 'MJD of observation start.',
820        expTime FLOAT(0) NOT NULL COMMENT 'Duration of exposure.',
821        darkTime FLOAT(0) NULL COMMENT 'Total elapsed time from exposure start to end of read.',
822        zd FLOAT(0) NOT NULL COMMENT 'Zenith distance at observation mid-point.',
823        airmass FLOAT(0) NULL COMMENT 'Airmass value for the Amp reference pixel (preferably center, but not guaranteed).',
824        PRIMARY KEY (ccdExposureId),
825        UNIQUE (visitId),
826        KEY (exposureId),
827        KEY (procHistoryId)
828) ;
829
830
831CREATE TABLE Raw_Amp_Exposure
832(
833        ampExposureId BIGINT NOT NULL,
834        amplifierId SMALLINT NOT NULL COMMENT 'Pointer to Amplifier table - this identifies which amplifier this AmpExposure corresponds to.',
835        ccdExposureId BIGINT NOT NULL COMMENT 'Pointer to CCDExposure that contains this AmpExposure',
836        procHistoryId INTEGER NOT NULL COMMENT 'Pointer to an entry in ProcessingHistory table.',
837        binX SMALLINT NULL COMMENT 'binning in X-coordinate',
838        binY SMALLINT NULL COMMENT 'binning in Y-coordinate',
839        sizeX SMALLINT NULL COMMENT 'Size of the image in X-direction (along rows; binned pixels). Ignores overscan but includes regions that may be considered outside of the data portion of the image.',
840        sizeY SMALLINT NULL COMMENT 'Size of the image in Y-direction (along columns; binned pixels). Ignores overscan but includes regions that may be considered outside of the data portion of the image.',
841        tai DOUBLE NULL COMMENT 'time of shutter open (international atomic time)',
842        texp FLOAT(0) NULL COMMENT 'Exposure time for this particular Amplifier. We are not certain yet that exposure times will be identical for all Amplifiers [FIXME] ',
843        bias FLOAT(0) NOT NULL COMMENT 'Bias level for the calibrated image (ADUs).',
844        gain FLOAT(0) NOT NULL COMMENT 'Gain value for the amplifier (e/ADU).',
845        rdNoise FLOAT(0) NOT NULL COMMENT 'Read noise value for this AmpExposure (measured in electrons).',
846        telAngle FLOAT(0) NOT NULL COMMENT 'Orientation angle of the telescope w.r.t sky (degrees).  Note: This is different from camera orientation w.r.t sky (encapsulated in WCS), since telescope is on alt-az mount.',
847        az FLOAT(0) NULL COMMENT 'Azimuth of observation (deg), preferably at center of exposure at center of image and including refraction correction, but none of this is guaranteed',
848        alt FLOAT(0) NULL COMMENT 'Altitude of observation (deg), preferably at center of observation at center of image and including refraction correction, but none of this is guaranteed',
849        flag SMALLINT NULL COMMENT 'Flags to indicate a problem/special condition with the AmpExposure (e.g. hardware, weather, etc)',
850        zpt DOUBLE NULL COMMENT 'Photometric zero point magnitude.',
851        zptErr FLOAT(0) NULL COMMENT 'Error of zero point magnitude.',
852        sky FLOAT(0) NOT NULL COMMENT 'The average sky level in the frame (ADU).',
853        skySig FLOAT(0) NULL COMMENT 'Sigma of distribution of sky values',
854        skyErr FLOAT(0) NULL COMMENT 'Error of the average sky value',
855        psf_nstar INTEGER NULL COMMENT 'Number of stars used for PSF measurement',
856        psf_apcorr FLOAT(0) NULL COMMENT 'Photometric error due to imperfect PSF model (aperture correction)',
857        psf_sigma1 FLOAT(0) NULL COMMENT 'Inner Gaussian sigma for the composite fit (XXX)',
858        psf_sigma2 FLOAT(0) NULL COMMENT 'Outer Gaussian sigma for the composite fit (XXX)',
859        psf_b FLOAT(0) NULL COMMENT 'Ratio of inner PSF to outer PSF (XXX)',
860        psf_b_2G FLOAT(0) NULL COMMENT 'Ratio of Gaussian 2 to Gaussian 1 at origin (XXX)',
861        psf_p0 FLOAT(0) NULL COMMENT 'The value of the power law at the origin (XXX)',
862        psf_beta FLOAT(0) NULL COMMENT 'The slope of the power law (XXX)',
863        psf_sigmap FLOAT(0) NULL COMMENT 'Width parameter for the power law (XXX)',
864        psf_nprof INTEGER NULL COMMENT 'Number of profile bins (XXX?)',
865        fwhm FLOAT(0) NOT NULL COMMENT 'Effective PSF width.',
866        sigma_x FLOAT(0) NULL,
867        sigma_y FLOAT(0) NULL,
868        posAngle FLOAT(0) NULL COMMENT 'psf related',
869        peak FLOAT(0) NULL COMMENT 'psf related',
870        x0 FLOAT(0) NULL COMMENT 'psf related',
871        x1 FLOAT(0) NULL COMMENT 'psf related',
872        radesys VARCHAR(5) NULL COMMENT 'Type of WCS used. Obsolete in ICRS',
873        equinox FLOAT(0) NOT NULL COMMENT 'Equinox of the WCS. Obsolete in ICRS',
874        ctype1 VARCHAR(20) NOT NULL COMMENT 'Coordinate type (axis 1). Obsolete in ICRS',
875        ctype2 VARCHAR(20) NOT NULL COMMENT 'Coordinate type (axis 2). Obsolete in ICRS',
876        cunit1 VARCHAR(10) NULL COMMENT 'X axis units',
877        cunit2 VARCHAR(10) NULL COMMENT 'Y axis units',
878        crpix1 FLOAT(0) NOT NULL COMMENT 'Pixel X-coordinate for reference pixel',
879        crpix2 FLOAT(0) NOT NULL COMMENT 'Pixel Y-coordinate for reference pixel',
880        crval1 FLOAT(0) NOT NULL COMMENT 'Sky coordinate (longitude) for reference pixel (degrees)',
881        crval2 FLOAT(0) NOT NULL COMMENT 'Sky coordinate (latitude) for reference pixel (degrees)',
882        cd11 FLOAT(0) NOT NULL COMMENT 'WCS transformation matrix element (_11)',
883        cd12 FLOAT(0) NOT NULL COMMENT 'WCS transformation matrix element (_12)',
884        cd21 FLOAT(0) NOT NULL COMMENT 'WCS transformation matrix element (_21)',
885        cd22 FLOAT(0) NOT NULL COMMENT 'WCS transformation matrix element (_22)',
886        cdelt1 FLOAT(0) NULL COMMENT 'Obsolete by cd_xx terms?',
887        cdelt2 FLOAT(0) NULL COMMENT 'Obsolete by cd_xx terms?',
888        PRIMARY KEY (ampExposureId),
889        KEY (amplifierId),
890        KEY (ccdExposureId),
891        KEY (procHistoryId)
892)  COMMENT='Table to store per-exposure information for every Amplifier.
893 tai+texp also added to this table, because there might be difference in the way focal plane is illuminated (finite shutter speed) leading to differences in exposure time between CCDs.
894 ISSUE: binX, binY, sizeX, sizeY can be dropped if we know for sure we never going to use pixel binning in LSST (confirm).';
895
896
897CREATE TABLE Calibration_CCD_Exposure
898(
899        ccdExposureId BIGINT NOT NULL,
900        exposureId INTEGER NOT NULL COMMENT 'Pointer to exposure.',
901        calibType TINYINT NOT NULL COMMENT 'with values like flat = 1, bias = 2, mask = 3, etc.',
902        filterId INTEGER NOT NULL COMMENT 'Pointer to filter information.',
903        equinox FLOAT(0) NOT NULL COMMENT 'Equinox of World Coordinate System.',
904        ctype1 VARCHAR(20) NOT NULL COMMENT ' Coordinate projection type, axis 1.',
905        ctype2 VARCHAR(20) NOT NULL COMMENT ' Coordinate projection type, axis 2.',
906        crpix1 FLOAT(0) NOT NULL COMMENT 'Coordinate reference pixel, axis 1.',
907        crpix2 FLOAT(0) NOT NULL COMMENT 'Coordinate reference pixel, axis 2.',
908        crval1 DOUBLE NOT NULL COMMENT 'Coordinate value 1 @reference pixel.',
909        crval2 DOUBLE NOT NULL COMMENT 'Coordinate value 2 @reference pixel.',
910        cd1_1 DOUBLE NOT NULL COMMENT 'First derivative of coordinate 1 w.r.t. axis 1.',
911        cd2_1 DOUBLE NOT NULL COMMENT 'First derivative of coordinate 2 w.r.t. axis 1.',
912        cd1_2 DOUBLE NOT NULL COMMENT 'First derivative of coordinate 1 w.r.t. axis 2.',
913        cd2_2 DOUBLE NOT NULL COMMENT 'First derivative of coordinate 2 w.r.t. axis 2.',
914        dateObs DATETIME NOT NULL COMMENT 'Date/Time of observation start (UTC).',
915        expTime FLOAT(0) NOT NULL COMMENT 'Duration of exposure.',
916        nCombine INTEGER NOT NULL DEFAULT 1 COMMENT 'Number of images co-added to create a deeper image',
917        PRIMARY KEY (ccdExposureId),
918        KEY (exposureId),
919        KEY (ccdExposureId)
920)  COMMENT='Placeholder...';
921
922
923CREATE TABLE _FPA_Flat2CMExposure
924(
925        flatExposureId INTEGER NOT NULL COMMENT 'Pointer to FlatExposure table.',
926        biasExposureId INTEGER NOT NULL COMMENT 'Pointer to BiasExposure table.',
927        darkExposureId INTEGER NOT NULL COMMENT 'Pointer to DarkExposure table.',
928        cmFlatExposureId INTEGER NOT NULL COMMENT 'Pointer to CMFlatExposure table',
929        KEY (biasExposureId),
930        KEY (cmFlatExposureId),
931        KEY (darkExposureId),
932        KEY (flatExposureId)
933)  COMMENT='Mapping table. Keeps information which FlatExposures are part of CalibratedMasterFlatExposure, and which BiasExposures & Dark Exposures were used to generate the CalibratedMasterFlatExposures.';
934
935
936CREATE TABLE _FPA_Dark2CMExposure
937(
938        darkExposureId INTEGER NOT NULL COMMENT 'Pointer to DarkExposure table.',
939        biasExposureId INTEGER NOT NULL COMMENT 'Pointer to BiasExposure table.',
940        cmDarkExposureId INTEGER NOT NULL COMMENT 'Pointer to CMDarkExposure table.',
941        KEY (biasExposureId),
942        KEY (cmDarkExposureId),
943        KEY (darkExposureId)
944)  COMMENT='Mapping table. Keeps information which DarkExposures are part of CalibratedMasterDarkExposure, and which BiasExposures were used to generate the CalibratedMasterDarkExposures.';
945
946
947CREATE TABLE _FPA_Bias2CMExposure
948(
949        biasExposureId INTEGER NOT NULL COMMENT 'Pointer to BiasExposure table.',
950        cmBiasExposureId INTEGER NOT NULL COMMENT 'Pointer to CMBiasExposure table.',
951        KEY (biasExposureId),
952        KEY (cmBiasExposureId)
953)  COMMENT='Mapping table. Keeps information which BiasExposures are part of CalibratedMasterBiasExposure.';
954
955
956CREATE TABLE _aux_Science_FPA_Exposure_Group
957(
958        dummy INTEGER NULL
959) ;
960
961
962CREATE TABLE prv_Snapshot
963(
964        snapshotId MEDIUMINT NOT NULL COMMENT 'Unique id.',
965        procHistoryId INTEGER NOT NULL COMMENT 'Pointer to an entry in ProcessingHistory table',
966        snapshotDescr VARCHAR(255) NULL,
967        PRIMARY KEY (snapshotId),
968        KEY (procHistoryId)
969)  COMMENT='Table for saving significant snapshots (for example ProcessingHistory used to produce a data release)';
970
971
972CREATE TABLE prv_cnf_MaskAmpImage
973(
974        cMaskAmpImageId BIGINT NOT NULL COMMENT 'Unique id.',
975        amplifierId SMALLINT NOT NULL COMMENT 'Pointer to Amplifier table - this determines which amplifier this config is used for.',
976        url VARCHAR(255) NULL COMMENT 'Logical URL to the MaskIage file corresponding to a given amplifier.',
977        validityBegin DATETIME NULL,
978        validityEnd DATETIME NULL,
979        PRIMARY KEY (cMaskAmpImageId),
980        KEY (amplifierId)
981) ;
982
983
984CREATE TABLE prv_cnf_Amplifier
985(
986        cAmplifierId SMALLINT NOT NULL COMMENT 'Unique id.',
987        amplifierId SMALLINT NOT NULL COMMENT 'Pointer to Amplifier table - amplifier that this config corresponds to.',
988        serialNumber VARCHAR(40) NULL COMMENT 'FIXME: Not sure what the type should be',
989        validityBegin DATETIME NULL,
990        validityEnd DATETIME NULL,
991        PRIMARY KEY (cAmplifierId),
992        KEY (amplifierId)
993) TYPE=MyISAM COMMENT='Table to store amplifier configuration. One row = hardware configuration of one amplifier';
994
995
996CREATE TABLE Visit
997(
998        visitId INTEGER NOT NULL,
999        exposureId INTEGER NOT NULL,
1000        UNIQUE (exposureId),
1001        KEY (exposureId)
1002)  COMMENT='Defines a single Visit. 1 row per LSST visit.';
1003
1004
1005CREATE TABLE Science_FPA_Exposure
1006(
1007        cseId INTEGER NOT NULL COMMENT 'Unique id.',
1008        exposureId INTEGER NOT NULL COMMENT 'Pointer to Exposure table. This also identifies Calibration_FPA_Exposure used to calibrated this exposure.',
1009        subtractedExposure INTEGER NOT NULL COMMENT 'Pointer to an entry in the Exposure table - a subtracted exposure.',
1010        varianceExposureId INTEGER NOT NULL COMMENT 'Pointer to an entry in the Exposure table - a variance exposure.',
1011        cseGroupId MEDIUMINT NOT NULL COMMENT 'Pointer to ScienceFPAExposure_Group table. There will be many ScienceFPAExposure entries with the same set of values, so it makes sense to normalize this and store as one entry in a separate table.',
1012        PRIMARY KEY (cseId),
1013        KEY (exposureId),
1014        KEY (subtractedExposure),
1015        KEY (varianceExposureId),
1016        KEY (cseGroupId)
1017)  COMMENT='Image metadata for the science calibrated exposure';
1018
1019
1020CREATE TABLE Calibration_FPA_Exposure
1021(
1022        exposureId INTEGER NOT NULL COMMENT 'Id of corresponding exposure in the FPA_Exposure table',
1023        PRIMARY KEY (exposureId),
1024        KEY (exposureId)
1025) ;
1026
1027
1028CREATE TABLE Flat_FPA_Exposure
1029(
1030        flatExposureId INTEGER NOT NULL COMMENT 'Corresponds to exposureId from Exposure table',
1031        filterId TINYINT NOT NULL COMMENT 'Pointer to Filter table - filter used to take this exposure',
1032        averPixelValue FLOAT(0) NULL,
1033        stdevPixelValue FLOAT(0) NULL COMMENT 'standard deviation',
1034        wavelength FLOAT(0) NULL,
1035        type TINYINT NULL COMMENT 'FIXME: convert type to ENUM: ''sky'', ''dome''',
1036        PRIMARY KEY (flatExposureId),
1037        KEY (flatExposureId)
1038)  COMMENT='Table for keeping (individual) FlatExposures. Coadded FlatExposures are kept in CMFlatExposure table.';
1039
1040
1041CREATE TABLE Dark_FPA_Exposure
1042(
1043        darkExposureId INTEGER NOT NULL COMMENT 'Corresponds to exposureId from Exposure table.',
1044        averPixelValue FLOAT(0) NULL,
1045        stdevPixelValue FLOAT(0) NULL COMMENT 'standard deviation',
1046        PRIMARY KEY (darkExposureId),
1047        KEY (darkExposureId)
1048)  COMMENT='Table for keeping (individual) DarkExposures. Coadded DarkExposures are kept in CMDarkExposure table.';
1049
1050
1051CREATE TABLE Bias_FPA_Exposure
1052(
1053        biasExposureId INTEGER NOT NULL COMMENT 'Corresponds to exposureId from Exposure table',
1054        averPixelValue FLOAT(0) NULL,
1055        stdevPixelValue FLOAT(0) NULL COMMENT 'standard deviation',
1056        PRIMARY KEY (biasExposureId),
1057        KEY (biasExposureId)
1058)  COMMENT='Table for keeping (individual) BiasExposures. Coadded BiasExposures are kept in CMBiasExposure table.';
1059
1060
1061CREATE TABLE aux_Fringe_FPA_CMExposure
1062(
1063        dummy INTEGER NULL
1064) ;
1065
1066
1067CREATE TABLE aux_Flat_FPA_CMExposure
1068(
1069        dummy INTEGER NULL
1070) ;
1071
1072
1073CREATE TABLE aux_Dark_FPA_CMExposure
1074(
1075        dummy INTEGER NULL
1076) ;
1077
1078
1079CREATE TABLE aux_Bias_FPA_CMExposure
1080(
1081        dummy INTEGER NULL
1082) ;
1083
1084
1085CREATE TABLE prv_ProcHistory
1086(
1087        procHistoryId INTEGER NOT NULL COMMENT 'Unique id.',
1088        PRIMARY KEY (procHistoryId)
1089)  COMMENT='Table keeps track of processing history. One row represents one batch of objects and/or sources and/or diasources and/or moving objects that were processed together. For each such group the table keeps track which Stage run, and time when the processing started. There is an assumption that configuration does not changes when during processing';
1090
1091
1092CREATE TABLE prv_cnf_CCD
1093(
1094        cCCDId SMALLINT NOT NULL COMMENT 'Unique id.',
1095        ccdId SMALLINT NOT NULL COMMENT 'Pointer to CCD table - ccd that this configuration corresponds to.',
1096        validityBegin DATETIME NULL,
1097        validityEnd DATETIME NULL,
1098        PRIMARY KEY (cCCDId),
1099        KEY (ccdId)
1100)  COMMENT='Table to store ccd configuration. One row = hardware configuration of one ccd';
1101
1102
1103CREATE TABLE prv_Amplifier
1104(
1105        amplifierId SMALLINT NOT NULL,
1106        ccdId SMALLINT NULL COMMENT 'Pointer to CCD this amplifier belongs to',
1107        amplifierDescr VARCHAR(80) NULL,
1108        PRIMARY KEY (amplifierId),
1109        KEY (ccdId)
1110)  COMMENT='One entry per amplifier "slot"';
1111
1112
1113CREATE TABLE prv_cnf_Stage2Pipeline
1114(
1115        cStage2PipelineId MEDIUMINT NOT NULL COMMENT 'Unique id.',
1116        stage2pipelineId MEDIUMINT NOT NULL COMMENT 'Pointer to entry in Stage2Pipeline that this config corresponds to.',
1117        validityBegin DATETIME NULL,
1118        validityEnd DATETIME NULL,
1119        PRIMARY KEY (cStage2PipelineId),
1120        KEY (stage2pipelineId)
1121) ;
1122
1123
1124CREATE TABLE prv_cnf_Pipeline2Run
1125(
1126        cPipeline2RunId MEDIUMINT NOT NULL COMMENT 'Unique id.',
1127        pipeline2runId MEDIUMINT NOT NULL COMMENT 'Pointer to entry in Pipeline2Run table that this config corresponds to.',
1128        validityBegin DATETIME NULL,
1129        validityEnd DATETIME NULL,
1130        PRIMARY KEY (cPipeline2RunId),
1131        KEY (pipeline2runId)
1132) ;
1133
1134
1135CREATE TABLE Raw_FPA_Exposure
1136(
1137        exposureId INTEGER NOT NULL COMMENT 'Unique id of an exposure. At most, there will be roughly 10^7 entries in this table: (3000 per night X 300 nights X 10 years).',
1138        filterId TINYINT NOT NULL COMMENT 'Pointer to Filter table - filter used when this exposure was taken.',
1139        procHistoryId INTEGER NULL COMMENT 'Pointer to ProcessingHistory. Valid if all pieces processed with the same processing history (all AmpExposures and all CCDExposures). If different processing histories used, then NULL',
1140        ra DOUBLE NOT NULL,
1141        decl DOUBLE NOT NULL,
1142        obsDate DATETIME NOT NULL COMMENT 'When image was taken (observation start). Note: datetime type does not have fractional seconds!',
1143        tai DOUBLE NOT NULL COMMENT 'time of shutter open (observation start), international atomic time.',
1144        taiDark DOUBLE NULL COMMENT 'time of shutter closed (during the exposure, if there was such an occasion; see Kem). International atomic time. There also could be a situation when the shutter was closed and reopened multiple times during the exposure. In this case, a more complicated data structure is needed?',
1145        azimuth FLOAT(0) NULL COMMENT '[in degrees]',
1146        elevation FLOAT(0) NULL COMMENT '[in degrees]',
1147        temperature FLOAT(0) NULL COMMENT '[in Celsius]',
1148        texp FLOAT(0) NOT NULL COMMENT 'Exposure time (total length of integration), sec. ',
1149        tDark FLOAT(0) NULL COMMENT 'Dark time length during exposure (clouds, etc). Again, this is a placeholder at the moment. Since this can happen multiple times (see comment for MJDdark attribute), a more complex data structure may be needed.',
1150        flag SMALLINT NULL COMMENT 'Flag to indicate a problem/special condition with the image (e.g. hardware, weather, etc).',
1151        ra_ll DOUBLE NOT NULL COMMENT 'ra for the low-left corner. We will probably do something more fancy than that in the real system...',
1152        dec_ll DOUBLE NOT NULL COMMENT 'del for the low-left corner. We will probably do something more fancy than that in the real system...',
1153        ra_lr DOUBLE NOT NULL COMMENT 'ra for the low-right corner. We will probably do something more fancy than that in the real system...',
1154        dec_lr DOUBLE NOT NULL COMMENT 'dec for the low-right corner. We will probably do something more fancy than that in the real system...',
1155        ra_ul DOUBLE NOT NULL COMMENT 'ra for the upper-left corner. We will probably do something more fancy than that in the real system...',
1156        dec_ul DOUBLE NOT NULL COMMENT 'dec for the upper-left corner. We will probably do something more fancy than that in the real system...',
1157        ra_ur DOUBLE NOT NULL COMMENT 'ra for the upper-right corner. We will probably do something more fancy than that in the real system...',
1158        dec_ur DOUBLE NOT NULL COMMENT 'dec for the upper-right corner. We will probably do something more fancy than that in the real system...',
1159        PRIMARY KEY (exposureId),
1160        KEY (filterId),
1161        KEY (procHistoryId)
1162) TYPE=MyISAM COMMENT='Table to store information about raw image metadata for the entire Focal Plane Assembly. Contains information from FITS header.
1163 ISSUE: For such a large FOV, do we expect amp-to-amp differences in texp, because shutter moves with finite speed?  If yes, texp and potentially mjd, etc should be moved further down the image hierarchy.
1164 ISSUE: To take previous issue even further: do we expect differences in integration time source-to-source, depending on their focal plane position?';
1165
1166
1167CREATE TABLE _aux_FPA_Fringe2CMExposure
1168(
1169        dummy INTEGER NULL
1170) ;
1171
1172
1173CREATE TABLE _aux_FPA_Flat2CMExposure
1174(
1175        dummy INTEGER NULL
1176) ;
1177
1178
1179CREATE TABLE _aux_FPA_Dark2CMExposure
1180(
1181        dummy INTEGER NULL
1182) ;
1183
1184
1185CREATE TABLE _aux_FPA_Bias2CMExposure
1186(
1187        dummy INTEGER NULL
1188) ;
1189
1190
1191CREATE TABLE prv_Stage2ProcHistory
1192(
1193        stageId SMALLINT NOT NULL COMMENT 'Pointer to an entry in prv_Stage table.',
1194        procHistoryId INTEGER NOT NULL COMMENT 'Pointer to ProcessingHistory',
1195        stageStart DATETIME NULL COMMENT 'Time when stage started.',
1196        stageEnd DATETIME NULL COMMENT 'Time when stage finished.',
1197        KEY (stageId),
1198        KEY (procHistoryId)
1199)  COMMENT='Table that keeps information which Stages belong to given processing history';
1200
1201
1202CREATE TABLE prv_cnf_Telescope
1203(
1204        cTelescopeId SMALLINT NOT NULL COMMENT 'Unique id.',
1205        telescopeId TINYINT NOT NULL COMMENT 'Pointer to Telescope table - telescope that this configuration corresponds to.',
1206        validityBegin DATETIME NULL,
1207        validityEnd DATETIME NULL,
1208        PRIMARY KEY (cTelescopeId),
1209        KEY (telescopeId)
1210) ;
1211
1212
1213CREATE TABLE prv_cnf_Raft
1214(
1215        cRaftId TINYINT NOT NULL COMMENT 'Unique id.',
1216        raftId SMALLINT NOT NULL COMMENT 'Pointer to Raft table - raft that this config corresponds to.',
1217        validityBegin DATETIME NULL,
1218        validityEnd DATETIME NULL,
1219        PRIMARY KEY (cRaftId),
1220        KEY (raftId)
1221)  COMMENT='Table to store raft configuration. One row = hardware configuration of one raft';
1222
1223
1224CREATE TABLE prv_cnf_Filter
1225(
1226        cFilterId TINYINT NOT NULL COMMENT 'Unique id.',
1227        filterId TINYINT NOT NULL COMMENT 'Pointer to Filter table - filter that this configuration corresponds to.',
1228        validityBegin DATETIME NULL,
1229        validityEnd DATETIME NULL,
1230        PRIMARY KEY (cFilterId),
1231        KEY (filterId)
1232)  COMMENT='Table to store filter configuration. One row = one physical filter. If a filter is replaced, a new entry should be created here';
1233
1234
1235CREATE TABLE prv_CCD
1236(
1237        ccdId SMALLINT NOT NULL COMMENT 'Unique id',
1238        raftId SMALLINT NOT NULL COMMENT 'Pointer to raft owning this ccd',
1239        amp01 SMALLINT NOT NULL,
1240        amp02 SMALLINT NOT NULL,
1241        amp03 SMALLINT NOT NULL,
1242        amp04 SMALLINT NOT NULL,
1243        amp05 SMALLINT NOT NULL,
1244        amp06 SMALLINT NOT NULL,
1245        amp07 SMALLINT NOT NULL,
1246        amp08 SMALLINT NOT NULL,
1247        amp09 SMALLINT NOT NULL,
1248        amp10 SMALLINT NOT NULL,
1249        PRIMARY KEY (ccdId),
1250        KEY (raftId)
1251)  COMMENT='Table that keeps assignment of Amplifier slots to CCD. 1 row = assignment for one CCD';
1252
1253
1254CREATE TABLE prv_Stage2UpdatableColumn
1255(
1256        stageId SMALLINT NOT NULL COMMENT 'Pointer to an entry in Stage table.',
1257        columnId SMALLINT NOT NULL COMMENT 'Pointer to an entry in UpdatableColumn table.',
1258        cStage2UpdateColumnId SMALLINT NOT NULL COMMENT 'Pointer to an entry in Config_Stage2UpdatableColumn table.',
1259        KEY (cStage2UpdateColumnId),
1260        KEY (stageId),
1261        KEY (columnId)
1262)  COMMENT='Mapping table. Keeps track between Stage --> set of columns that given Stage can update, and time period during which given mapping is valid.';
1263
1264
1265CREATE TABLE prv_Stage2Pipeline
1266(
1267        stage2pipelineId MEDIUMINT NOT NULL COMMENT 'Unique id.',
1268        pipelineId TINYINT NOT NULL COMMENT 'Pointer to an entry in Pipeline table.',
1269        stageId SMALLINT NOT NULL COMMENT 'Pointer to an entry in Stage table.',
1270        PRIMARY KEY (stage2pipelineId),
1271        KEY (pipelineId),
1272        KEY (stageId)
1273)  COMMENT='Mapping table. Keep tracks of mapping which ProcessingSteps are part of a given Pipeline and during what time period given configuration was valid.';
1274
1275
1276CREATE TABLE prv_Pipeline2Run
1277(
1278        pipeline2runId MEDIUMINT NOT NULL COMMENT 'Unique id.',
1279        runId MEDIUMINT NOT NULL COMMENT 'Pointer to Run table',
1280        pipelineId TINYINT NOT NULL COMMENT 'Pointer to Pipeline table.',
1281        PRIMARY KEY (pipeline2runId),
1282        KEY (pipelineId),
1283        KEY (runId)
1284)  COMMENT='Mapping table. Keep tracks of mapping which Pipelines are part of a given Run, and during what time period given configuration was valid.';
1285
1286
1287CREATE TABLE prv_cnf_Stage2Slice
1288(
1289        cStage2SliceId MEDIUMINT NOT NULL COMMENT 'Unique id.',
1290        stage2sliceId MEDIUMINT NOT NULL COMMENT 'Pointer to an entry in Stage2SliceId that this config corresponds to.',
1291        validityBegin DATETIME NULL,
1292        validityEnd DATETIME NULL,
1293        PRIMARY KEY (cStage2SliceId),
1294        KEY (stage2sliceId)
1295) ;
1296
1297
1298CREATE TABLE prv_cnf_Slice
1299(
1300        nodeId SMALLINT NOT NULL COMMENT 'Pointer to a node that this given slice runs on.',
1301        sliceId MEDIUMINT NOT NULL COMMENT 'Pointer to an entry in Slice table that this config corresponds to.',
1302        validityBegin DATETIME NULL,
1303        validityEnd DATETIME NULL,
1304        KEY (nodeId),
1305        KEY (sliceId)
1306) ;
1307
1308
1309CREATE TABLE prv_cnf_Node
1310(
1311        cNodeId INTEGER NOT NULL COMMENT 'Unique id.',
1312        nodeId SMALLINT NOT NULL COMMENT 'Pointer to Node table - node that this configuration corresponds to.',
1313        validityBegin DATETIME NULL,
1314        validityEnd DATETIME NULL,
1315        PRIMARY KEY (cNodeId),
1316        KEY (nodeId)
1317) ;
1318
1319
1320CREATE TABLE _Science_FPA_Exposure2TemplateImage
1321(
1322        exposureId INTEGER NOT NULL COMMENT 'Pointer to an entry in Exposure table.',
1323        templateImageId INTEGER NOT NULL COMMENT 'Pointer to an entry in TemplateImage table.',
1324        KEY (templateImageId),
1325        KEY (exposureId)
1326)  COMMENT='Mapping table: exposures used to build given template image';
1327
1328
1329CREATE TABLE _Science_FPA_Exposure_Group
1330(
1331        cseGroupId MEDIUMINT NOT NULL COMMENT 'Unique id.',
1332        darkTime DATETIME NULL COMMENT 'Timestamp when corresponding CMDarkExposure was processed.',
1333        biasTime DATETIME NULL COMMENT 'Timestamp when corresponding CMBiasExposure was processed.',
1334        u_fringeTime DATETIME NULL COMMENT 'Timestamp when corresponding CMFringeExposure was processed. For u filter.',
1335        g_fringeTime DATETIME NULL COMMENT 'Timestamp when corresponding CMFringeExposure was processed. For g filter.',
1336        r_fringeTime DATETIME NULL COMMENT 'Timestamp when corresponding CMFringeExposure was processed. For r filter.',
1337        i_fringeTime DATETIME NULL COMMENT 'Timestamp when corresponding CMFringeExposure was processed. For i filter.',
1338        z_fringeTime DATETIME NULL COMMENT 'Timestamp when corresponding CMFringeExposure was processed. For z filter.',
1339        y_fringeTime DATETIME NULL COMMENT 'Timestamp when corresponding CMFringeExposure was processed. For y filter.',
1340        u_flatTime DATETIME NULL COMMENT 'Timestamp when corresponding CMFlatExposure was processed. For u filter.',
1341        g_FlatTime DATETIME NULL COMMENT 'Timestamp when corresponding CMFlatExposure was processed. For g filter.',
1342        r_flatTime DATETIME NULL COMMENT 'Timestamp when corresponding CMFlatExposure was processed. For r filter.',
1343        i_flatTime DATETIME NULL COMMENT 'Timestamp when corresponding CMFlatExposure was processed. For i filter.',
1344        z_flatTime DATETIME NULL COMMENT 'Timestamp when corresponding CMFlatExposure was processed. For z filter.',
1345        y_flatTime DATETIME NULL COMMENT 'Timestamp when corresponding CMFlatExposure was processed. For y filter.',
1346        cmBiasExposureId INTEGER NULL COMMENT 'Pointer to CalibratedMasterBiasExposure.',
1347        cmDarkExposureId INTEGER NULL COMMENT 'Pointer to CalibratedMasterDarkExposure. ',
1348        u_cmFlatExposureId INTEGER NULL COMMENT 'Pointer to CalibratedMasterFlatExposure for u filter.',
1349        g_cmFlatExposureId INTEGER NULL COMMENT 'Pointer to CalibratedMasterFlatExposure for g filter.',
1350        r_cmFlatExposureId INTEGER NULL COMMENT 'Pointer to CalibratedMasterFlatExposure for r filter.',
1351        i_cmFlatExposureId INTEGER NULL COMMENT 'Pointer to CalibratedMasterFlatExposure for i filter.',
1352        z_cmFlatExposureId INTEGER NULL COMMENT 'Pointer to CalibratedMasterFlatExposure for z filter.',
1353        y_cmFlatExposureId INTEGER NULL COMMENT 'Pointer to CalibratedMasterFlatExposure for y filter.',
1354        u_cmFringeExposureId INTEGER NULL COMMENT 'Pointer to CalibratedMasterFringeExposure for u filter.',
1355        g_cmFringeExposureId INTEGER NULL COMMENT 'Pointer to CalibratedMasterFringeExposure for g filter.',
1356        r_cmFringeExposureId INTEGER NULL COMMENT 'Pointer to CalibratedMasterFringeExposure for r filter.',
1357        i_cmFringeExposureId INTEGER NULL COMMENT 'Pointer to CalibratedMasterFringeExposure for i filter.',
1358        z_cmFringeExposureId INTEGER NULL COMMENT 'Pointer to CalibratedMasterFringeExposure for z filter.',
1359        y_cmFringeExposureId INTEGER NULL COMMENT 'Pointer to CalibratedMasterFringeExposure for y filter. ',
1360        PRIMARY KEY (cseGroupId),
1361        KEY (cmBiasExposureId),
1362        KEY (cmDarkExposureId),
1363        KEY (u_cmFlatExposureId)
1364) ;
1365
1366
1367CREATE TABLE _FPA_Fringe2CMExposure
1368(
1369        biasExposureId INTEGER NOT NULL COMMENT 'Pointer to BiasExposure table.',
1370        darkExposureId INTEGER NOT NULL COMMENT 'Pointer to DarkExposure table.',
1371        flatExposureId INTEGER NOT NULL COMMENT 'Pointer to FlatExposure table.',
1372        cmFringeExposureId INTEGER NOT NULL COMMENT 'Pointer to CMFringeExposure table.',
1373        KEY (biasExposureId),
1374        KEY (cmFringeExposureId),
1375        KEY (darkExposureId),
1376        KEY (flatExposureId)
1377)  COMMENT='Mapping table. Keeps information which FlatExposures are part of CalibratedMasterFringeExposure, and which BiasExposures & Dark Exposures were used to generate the CalibratedMasterFringeExposures.';
1378
1379
1380CREATE TABLE _SourceClassif2Descr
1381(
1382        scId INTEGER NOT NULL COMMENT 'Pointer to an entry in SourceClassification table.',
1383        scAttrId SMALLINT NOT NULL COMMENT 'Pointer to an entry in SourceClassifAttr table',
1384        scDescrId SMALLINT NOT NULL COMMENT 'Pointer to an entry in SourceClassifDescr table.',
1385        status BIT NULL DEFAULT 1 COMMENT 'Status: ''yes'' / ''no''. Default: ''yes''',
1386        KEY (scId),
1387        KEY (scAttrId),
1388        KEY (scDescrId)
1389)  COMMENT='Mapping table: SourceClassif --> (SourceClassifAttr + SourceClassifDescr + value "yes/no")';
1390
1391
1392CREATE TABLE _Object2Type
1393(
1394        objectId BIGINT NOT NULL COMMENT 'Pointer to an entry in Object table',
1395        typeId SMALLINT NOT NULL COMMENT 'Pointer to an entry in ObjectType table',
1396        probability TINYINT NULL DEFAULT 100 COMMENT 'Probability that given object is of given type. Range 0-100 %',
1397        KEY (objectId),
1398        KEY (typeId)
1399)  COMMENT='Mapping Object --> types, with probabilities';
1400
1401
1402CREATE TABLE _MovingObject2Type
1403(
1404        movingObjectId BIGINT NOT NULL COMMENT 'Pointer to entry in MovingObject table',
1405        typeId SMALLINT NOT NULL COMMENT 'Pointer to entry in ObjectType table',
1406        probability TINYINT NULL DEFAULT 100 COMMENT 'Probability that given MovingObject is of given type. Range: 0-100 (in%)',
1407        KEY (movingObjectId),
1408        KEY (typeId)
1409)  COMMENT='Mapping: moving object --> types, with probabilities';
1410
1411
1412CREATE TABLE _Alert2Type
1413(
1414        alertTypeId SMALLINT NOT NULL COMMENT 'Pointer to AlertType',
1415        alertId INTEGER NOT NULL COMMENT 'Pointer to Alert',
1416        KEY (alertId),
1417        KEY (alertTypeId)
1418) ;
1419
1420
1421CREATE TABLE aux_Source
1422(
1423        dummy INTEGER NULL
1424) ;
1425
1426
1427CREATE TABLE aux_IR_FPA_Exposure
1428(
1429        dummy INTEGER NULL
1430)  COMMENT='Kem: "we need an IRexposure table, and probably a CloudMap table (which connects IRexposures to 2-D maps of clouds in a particular exposure.  The IRexposure should link to each ScienceExposure."';
1431
1432
1433CREATE TABLE aux_Science_FPA_SpectraExposure
1434(
1435        dummy INTEGER NULL
1436) ;
1437
1438
1439CREATE TABLE aux_Flat_FPA_Exposure
1440(
1441        dummy INTEGER NULL
1442) ;
1443
1444
1445CREATE TABLE aux_Dark_FPA_Exposure
1446(
1447        dummy INTEGER NULL
1448) ;
1449
1450
1451CREATE TABLE aux_Calibration_FPA_Exposure
1452(
1453        dummy INTEGER NULL
1454) ;
1455
1456
1457CREATE TABLE aux_Bias_FPA_Exposure
1458(
1459        dummy INTEGER NULL
1460) ;
1461
1462
1463CREATE TABLE prv_UpdatableColumn
1464(
1465        columnId SMALLINT NOT NULL COMMENT 'Unique id.',
1466        tableId SMALLINT NOT NULL COMMENT 'Pointer to an entry in UpdatableTable, a table this column belongs to.',
1467        columnName VARCHAR(64) NOT NULL COMMENT 'Name, must be the same as in the database schema.',
1468        PRIMARY KEY (columnId),
1469        KEY (tableId)
1470)  COMMENT='Keep track of all columns that are updated by pipelines/stages';
1471
1472
1473CREATE TABLE prv_Telescope
1474(
1475        telescopeId TINYINT NOT NULL COMMENT 'Unique id.',
1476        focalPlaneId TINYINT NOT NULL COMMENT 'Pointer to an entry in FocalPlane table.',
1477        PRIMARY KEY (telescopeId),
1478        KEY (focalPlaneId)
1479) ;
1480
1481
1482CREATE TABLE prv_Raft
1483(
1484        raftId SMALLINT NOT NULL COMMENT 'Unique id.',
1485        focalPlaneId TINYINT NOT NULL COMMENT 'Pointer to an entry in the focal plane.',
1486        ccd01 SMALLINT NOT NULL,
1487        ccd02 SMALLINT NOT NULL,
1488        ccd03 SMALLINT NOT NULL,
1489        ccd04 SMALLINT NOT NULL,
1490        ccd05 SMALLINT NOT NULL,
1491        ccd06 SMALLINT NOT NULL,
1492        ccd07 SMALLINT NOT NULL,
1493        ccd08 SMALLINT NOT NULL,
1494        ccd09 SMALLINT NOT NULL,
1495        PRIMARY KEY (raftId),
1496        KEY (focalPlaneId)
1497)  COMMENT='Table that keeps assignment of CCDs to Rafts. 1 row: assignement for 1 raft';
1498
1499
1500CREATE TABLE prv_Filter
1501(
1502        filterId TINYINT NOT NULL COMMENT 'Unique id.',
1503        focalPlaneId TINYINT NOT NULL COMMENT 'Pointer to FocalPlane - focal plane this filter belongs to.',
1504        name VARCHAR(80) NOT NULL COMMENT 'String description of the filter,e.g. ''VR SuperMacho c6027'' ',
1505        url VARCHAR(255) NULL COMMENT 'URL for filter transmission curve. (Added from archive specs for LSST precursor data).',
1506        clam FLOAT(0) NOT NULL COMMENT 'Filter centroid wavelength (Angstroms). (Added from archive specs for LSST precursor data).',
1507        bw FLOAT(0) NOT NULL COMMENT 'Filter effective bandwidth (Angstroms). (Added from archive specs for LSST precursor data).',
1508        PRIMARY KEY (filterId),
1509        UNIQUE (name),
1510        KEY (focalPlaneId)
1511) TYPE=MyISAM COMMENT='One row per color - the table will have 6 rows';
1512
1513
1514CREATE TABLE prv_cnf_FocalPlane
1515(
1516        cFocalPlaneId SMALLINT NOT NULL COMMENT 'Unique id.',
1517        focalPlaneId TINYINT NOT NULL COMMENT 'Pointer to FocalPlane table - focal plane that this configuration corresponds to.',
1518        validityBegin DATETIME NULL,
1519        validityEnd DATETIME NULL,
1520        PRIMARY KEY (cFocalPlaneId),
1521        KEY (focalPlaneId)
1522)  COMMENT='Table to store focal plane configuration.';
1523
1524
1525CREATE TABLE prv_Stage2Slice
1526(
1527        stage2SliceId MEDIUMINT NOT NULL COMMENT 'Unique id.',
1528        stageId SMALLINT NOT NULL COMMENT 'Pointer to an entry in Stage table.',
1529        sliceId MEDIUMINT NOT NULL COMMENT 'Pointer to an entry in Slice table.',
1530        PRIMARY KEY (stage2SliceId),
1531        KEY (sliceId),
1532        KEY (stageId)
1533)  COMMENT='Mapping table. Keeps track of mapping between Stages and Slices.';
1534
1535
1536CREATE TABLE prv_Stage
1537(
1538        stageId SMALLINT NOT NULL COMMENT 'Unique id.',
1539        policyId MEDIUMINT NOT NULL COMMENT 'Pointer to Policy table: Stage-related policy.',
1540        stageName VARCHAR(255) NULL,
1541        PRIMARY KEY (stageId),
1542        KEY (policyId)
1543)  COMMENT='Table that defines all LSST stages. Actual Stage configurations are tracked through Config_Stage2Pipeline';
1544
1545
1546CREATE TABLE prv_Run
1547(
1548        runId MEDIUMINT NOT NULL COMMENT 'Unique id.',
1549        policyId MEDIUMINT NOT NULL COMMENT 'Pointer to Policy table: run-related policy.',
1550        PRIMARY KEY (runId),
1551        KEY (policyId)
1552)  COMMENT='Table to define LSST run. An example of a run "nightly processing run"';
1553
1554
1555CREATE TABLE prv_Pipeline
1556(
1557        pipelineId TINYINT NOT NULL COMMENT 'Unique id.',
1558        policyId MEDIUMINT NOT NULL COMMENT 'Pointer to Policy table: pipeline-related table.',
1559        pipelineName VARCHAR(64) NULL COMMENT 'name of the pipeline',
1560        PRIMARY KEY (pipelineId),
1561        KEY (policyId)
1562)  COMMENT='Defines all LSST pipelines. 1 row = 1 pipeline. Actual configurations (which stages are part of given pipeline) are tracked through cnf_Stage2Pipeline';
1563
1564
1565CREATE TABLE prv_Node
1566(
1567        nodeId SMALLINT NOT NULL COMMENT 'Unique id.',
1568        policyId MEDIUMINT NOT NULL COMMENT 'Pointer to Policy table: node-related policy.',
1569        PRIMARY KEY (nodeId),
1570        KEY (policyId)
1571) ;
1572
1573
1574CREATE TABLE prv_cnf_Policy
1575(
1576        cPolicyId MEDIUMINT NOT NULL COMMENT 'Unique id.',
1577        policyId MEDIUMINT NOT NULL COMMENT 'Pointer to Policy table - policy that this config corresponds to.',
1578        validityBegin DATETIME NULL,
1579        validityEnd DATETIME NULL,
1580        PRIMARY KEY (cPolicyId),
1581        KEY (policyId)
1582) ;
1583
1584
1585CREATE TABLE TemplateImage
1586(
1587        templateImageId INTEGER NOT NULL COMMENT 'Unique id.',
1588        PRIMARY KEY (templateImageId)
1589)  COMMENT='Table that defines which template images';
1590
1591
1592CREATE TABLE PostageStampJpegs
1593(
1594        ra DOUBLE NOT NULL COMMENT 'ra of upper left corner',
1595        decl DOUBLE NULL COMMENT 'decl or upper left corner',
1596        sizeRa FLOAT(0) NOT NULL,
1597        sizeDecl FLOAT(0) NOT NULL,
1598        url VARCHAR(255) NULL COMMENT 'logical url of the jpeg image'
1599) ;
1600
1601
1602CREATE TABLE Fringe_FPA_CMExposure
1603(
1604        cdFringeExposureId INTEGER NOT NULL COMMENT 'Unique id.',
1605        PRIMARY KEY (cdFringeExposureId)
1606)  COMMENT='Calibrated Master FringeExposure: a bias exposure that is composed of multiple single fringe exposures.';
1607
1608
1609CREATE TABLE Flat_FPA_CMExposure
1610(
1611        cmFlatExposureId INTEGER NOT NULL COMMENT 'Unique id.',
1612        PRIMARY KEY (cmFlatExposureId)
1613)  COMMENT='Calibrated Master Flat Exposure: a bias exposure that is composed of multiple single flat exposures.';
1614
1615
1616CREATE TABLE Dark_FPA_CMExposure
1617(
1618        cmDarkExposureId INTEGER NOT NULL COMMENT 'Unique id.',
1619        PRIMARY KEY (cmDarkExposureId)
1620)  COMMENT='Calibrated Master Dark Exposure: a bias exposure that is composed of multiple single dark exposures.';
1621
1622
1623CREATE TABLE Bias_FPA_CMExposure
1624(
1625        cmBiasExposureId INTEGER NOT NULL COMMENT 'Unique id.',
1626        PRIMARY KEY (cmBiasExposureId)
1627)  COMMENT='Calibrated Master Bias Exposure: a bias exposure that is composed of multiple single bias exposures.';
1628
1629
1630CREATE TABLE SourceClassifDescr
1631(
1632        scDescrId SMALLINT NOT NULL COMMENT 'Unique id.',
1633        scDescr VARCHAR(255) NOT NULL COMMENT 'description',
1634        PRIMARY KEY (scDescrId)
1635)  COMMENT='Entries stored in this table are used to construct the Source Classification table (rows). Examples: "present in both visits", "shape differs in two visits", elliptical after PSF deconvolve",  "positive flux excursion".';
1636
1637
1638CREATE TABLE SourceClassifAttr
1639(
1640        scAttrId SMALLINT NOT NULL COMMENT 'Unique id.',
1641        scAttrDescr VARCHAR(255) NOT NULL COMMENT 'Attribute description.',
1642        PRIMARY KEY (scAttrId)
1643)  COMMENT='Entries stored in this table are used to construct the Source Classification table (columns). Examples: "Cosmin Ray", "Negative Excursion", "Positive Excursion", "Fast Mover", "Flash".';
1644
1645
1646CREATE TABLE SourceClassif
1647(
1648        scId INTEGER NOT NULL COMMENT 'Unique id.',
1649        PRIMARY KEY (scId)
1650)  COMMENT='Table keeping information about source classification.';
1651
1652
1653CREATE TABLE ObjectType
1654(
1655        typeId SMALLINT NOT NULL COMMENT 'Unique id.',
1656        description VARCHAR(255) NULL,
1657        PRIMARY KEY (typeId)
1658)  COMMENT='Table to store description of object types. It includes all object types: static, variables, Solar System objects, etc.';
1659
1660
1661CREATE TABLE AlertType
1662(
1663        alertTypeId SMALLINT NOT NULL COMMENT 'unique id of alert type',
1664        alertTypeDescr VARCHAR(50) NULL COMMENT 'Description of the alert type.',
1665        PRIMARY KEY (alertTypeId)
1666) TYPE=MyISAM COMMENT='Table to store alert types';
1667
1668
1669CREATE TABLE __SQLLog_placeholder
1670(
1671        sqlLogId BIGINT NOT NULL,
1672        tstamp DATETIME NOT NULL COMMENT 'Timestamp when query was issued',
1673        elapsed FLOAT(0) NOT NULL COMMENT 'Length of the query execution (sec?)',
1674        userId INTEGER NOT NULL COMMENT 'Unique user identifier (among users logged on?)',
1675        domain VARCHAR(80) NOT NULL COMMENT 'Domain name',
1676        ipaddr VARCHAR(80) NOT NULL COMMENT 'IP address where query originated',
1677        query TEXT NOT NULL COMMENT 'Query text string (SQL)',
1678        PRIMARY KEY (sqlLogId)
1679) TYPE=MyISAM COMMENT='Table to store DB usage statistics. Placeholder.';
1680
1681
1682CREATE TABLE aux_Object
1683(
1684        dummy INTEGER NULL
1685) ;
1686
1687
1688CREATE TABLE aux_SED
1689(
1690        dummy INTEGER NULL
1691)  COMMENT='Spectral Energy Distribution. Kem: "...SED tables having SEDstdID, altitude, azimuth and an URL to transmission vs wavelength"';
1692
1693
1694CREATE TABLE aux_LIDARshot
1695(
1696        dummy INTEGER NULL
1697)  COMMENT='Kem: "There should be a LIDARshot table which has a time, wavelength, altitude, azimuth and two URLs pointing to a 1-D file of delay-time versus intensity and a transparency vs wavelenght file."';
1698
1699
1700CREATE TABLE aux_FPA_Exposure
1701(
1702        dummy INTEGER NULL
1703) ;
1704
1705
1706CREATE TABLE aux_CloudMap
1707(
1708        dummy INTEGER NULL
1709) ;
1710
1711
1712CREATE TABLE aux_Amp_Exposure
1713(
1714        dummy INTEGER NULL
1715) ;
1716
1717
1718CREATE TABLE _aux_Science_FPA_SpectraExposure_Group
1719(
1720        dummy INTEGER NULL
1721) ;
1722
1723
1724CREATE TABLE prv_UpdatableTable
1725(
1726        tableId SMALLINT NOT NULL COMMENT 'Unique id.',
1727        tableName VARCHAR(64) NOT NULL COMMENT 'Name of table (must be the same as in schema, for example Object, DIASource...)',
1728        PRIMARY KEY (tableId)
1729)  COMMENT='Keeps track of names of database tables that are (or can be) updated by stages.';
1730
1731
1732CREATE TABLE prv_FocalPlane
1733(
1734        focalPlaneId TINYINT NOT NULL COMMENT 'Unique id.',
1735        PRIMARY KEY (focalPlaneId)
1736)  COMMENT='Each row keeps assignment of Rafts to FocalPlane (there will be just one row I guess...)';
1737
1738
1739CREATE TABLE prv_Slice
1740(
1741        sliceId MEDIUMINT NOT NULL COMMENT 'Unique id.',
1742        PRIMARY KEY (sliceId)
1743) ;
1744
1745
1746CREATE TABLE prv_Policy
1747(
1748        policyId MEDIUMINT NOT NULL COMMENT 'Unique id.',
1749        policyName VARCHAR(80) NOT NULL,
1750        PRIMARY KEY (policyId)
1751) ;
1752
1753
1754CREATE TABLE prv_cnf_Stage2UpdatableColumn
1755(
1756        c_stage2UpdatableColumn SMALLINT NOT NULL COMMENT 'Unique id.',
1757        validityBegin DATETIME NULL,
1758        validityEnd DATETIME NULL,
1759        PRIMARY KEY (c_stage2UpdatableColumn)
1760) ;
1761
1762
1763
1764
1765
1766ALTER TABLE _DIASource2Alert ADD CONSTRAINT FK_DIASource2Alert_Alert
1767        FOREIGN KEY (alertId) REFERENCES Alert (timeGenerated);
1768
1769ALTER TABLE VarObject ADD CONSTRAINT FK_VarObject_Object_objectId
1770        FOREIGN KEY (objectId) REFERENCES Object (latestObsTime);
1771
1772ALTER TABLE Source ADD CONSTRAINT FK_Source_MovingObject_movingObjectId
1773        FOREIGN KEY (movingObjectId) REFERENCES MovingObject (movingObjectId);
1774
1775ALTER TABLE Source ADD CONSTRAINT FK_Source_Object_objectId
1776        FOREIGN KEY (objectId) REFERENCES Object (latestObsTime);
1777
1778ALTER TABLE ObjectPhotoZ ADD CONSTRAINT FK_ObjectPhotoZ_Object_objectId
1779        FOREIGN KEY (objectId) REFERENCES Object (latestObsTime);
1780
1781ALTER TABLE Alert ADD CONSTRAINT FK_Alert_Object
1782        FOREIGN KEY (objectId) REFERENCES Object (objectId);
1783
1784ALTER TABLE Science_CCD_Exposure ADD CONSTRAINT FK_Science_CCD_Exposure_Raw_CCD_Exposure
1785        FOREIGN KEY (ccdExposureId) REFERENCES Raw_CCD_Exposure (ccdExposureId);
1786
1787ALTER TABLE Science_Amp_Exposure ADD CONSTRAINT FK_Science_Amp_Exposure_Raw_Amp_Exposure
1788        FOREIGN KEY (ampExposureId) REFERENCES Raw_Amp_Exposure (ampExposureId);
1789
1790ALTER TABLE Science_Amp_Exposure ADD CONSTRAINT FK_Science_Amp_Exposure_Science_CCD_Exposure
1791        FOREIGN KEY (ccdExposureId) REFERENCES Science_CCD_Exposure (ccdExposureId);
1792
1793ALTER TABLE Calibration_Amp_Exposure ADD CONSTRAINT FK_Calibration_Amp_Exposure_Calibration_CCD_Exposure
1794        FOREIGN KEY (ccdExposureId) REFERENCES Calibration_CCD_Exposure (ccdExposureId);
1795
1796ALTER TABLE Calibration_Amp_Exposure ADD CONSTRAINT FK_Calibration_Amp_Exposure_Raw_Amp_Exposure
1797        FOREIGN KEY (ampExposureId) REFERENCES Raw_Amp_Exposure (ampExposureId);
1798
1799ALTER TABLE _Source2Object ADD CONSTRAINT FK_Source2Object_Object
1800        FOREIGN KEY (objectId) REFERENCES Object (objectId);
1801
1802ALTER TABLE _Source2Object ADD CONSTRAINT FK_Source2Object_Source
1803        FOREIGN KEY (sourceId) REFERENCES Source (sourceId);
1804
1805ALTER TABLE _Source2Amp_Exposure ADD CONSTRAINT FK_Source2Exposure_Source
1806        FOREIGN KEY (sourceId) REFERENCES Source (sourceId);
1807
1808ALTER TABLE Raw_CCD_Exposure ADD CONSTRAINT FK_CCDExposure_FPAExposure_exposureId
1809        FOREIGN KEY (exposureId) REFERENCES Raw_FPA_Exposure (exposureId);
1810
1811ALTER TABLE Raw_Amp_Exposure ADD CONSTRAINT FK_AmpExposure_CCDExposure_ccdExposureId
1812        FOREIGN KEY (ccdExposureId) REFERENCES Raw_CCD_Exposure (ccdExposureId);
1813
1814ALTER TABLE Calibration_CCD_Exposure ADD CONSTRAINT FK_Calibration_CCD_Exposure_Calibration_FPA_Exposure
1815        FOREIGN KEY (exposureId) REFERENCES Calibration_FPA_Exposure (exposureId);
1816
1817ALTER TABLE Calibration_CCD_Exposure ADD CONSTRAINT FK_Calibration_CCD_Exposure_Raw_CCD_Exposure
1818        FOREIGN KEY (ccdExposureId) REFERENCES Raw_CCD_Exposure (ccdExposureId);
1819
1820ALTER TABLE _FPA_Flat2CMExposure ADD CONSTRAINT FK_MasterFlat2Exposure_BiasExposure
1821        FOREIGN KEY (biasExposureId) REFERENCES Bias_FPA_Exposure (biasExposureId);
1822
1823ALTER TABLE _FPA_Flat2CMExposure ADD CONSTRAINT FK_MasterFlat2Exposure_DarkExposure
1824        FOREIGN KEY (darkExposureId) REFERENCES Dark_FPA_Exposure (darkExposureId);
1825
1826ALTER TABLE _FPA_Flat2CMExposure ADD CONSTRAINT FK_MasterFlat2Exposure_FlatExposure
1827        FOREIGN KEY (flatExposureId) REFERENCES Flat_FPA_Exposure (flatExposureId);
1828
1829ALTER TABLE _FPA_Dark2CMExposure ADD CONSTRAINT FK_MasterDark2Exposure_BiasExposure
1830        FOREIGN KEY (biasExposureId) REFERENCES Bias_FPA_Exposure (biasExposureId);
1831
1832ALTER TABLE _FPA_Dark2CMExposure ADD CONSTRAINT FK_MasterDark2Exposure_CalibratedMasterDarkExposure
1833        FOREIGN KEY (cmDarkExposureId) REFERENCES Dark_FPA_CMExposure (cmDarkExposureId);
1834
1835ALTER TABLE _FPA_Dark2CMExposure ADD CONSTRAINT FK_MasterDark2Exposure_DarkExposure
1836        FOREIGN KEY (darkExposureId) REFERENCES Dark_FPA_Exposure (darkExposureId);
1837
1838ALTER TABLE _FPA_Bias2CMExposure ADD CONSTRAINT FK_MasterBias2Exposure_BiasExposure
1839        FOREIGN KEY (biasExposureId) REFERENCES Bias_FPA_Exposure (biasExposureId);
1840
1841ALTER TABLE _FPA_Bias2CMExposure ADD CONSTRAINT FK_MasterBias2Exposure_CalibratedMasterBiasExposure
1842        FOREIGN KEY (cmBiasExposureId) REFERENCES Bias_FPA_CMExposure (cmBiasExposureId);
1843
1844ALTER TABLE prv_Snapshot ADD CONSTRAINT FK_Snapshot_ProcessingHistory
1845        FOREIGN KEY (procHistoryId) REFERENCES prv_ProcHistory (procHistoryId);
1846
1847ALTER TABLE prv_cnf_MaskAmpImage ADD CONSTRAINT FK_Config_MaskAmpImage_Amplifier
1848        FOREIGN KEY (amplifierId) REFERENCES prv_Amplifier (amplifierId);
1849
1850ALTER TABLE prv_cnf_Amplifier ADD CONSTRAINT FK_Config_Amplifier_Amplifier
1851        FOREIGN KEY (amplifierId) REFERENCES prv_Amplifier (amplifierId);
1852
1853ALTER TABLE Visit ADD CONSTRAINT FK_Visit_Raw_FPA_Exposure
1854        FOREIGN KEY (exposureId) REFERENCES Raw_FPA_Exposure (exposureId);
1855
1856ALTER TABLE Calibration_FPA_Exposure ADD CONSTRAINT FK_CalibrationFPAExposure_FPAExposure_exposureId
1857        FOREIGN KEY (exposureId) REFERENCES Raw_FPA_Exposure (exposureId);
1858
1859ALTER TABLE prv_cnf_CCD ADD CONSTRAINT FK_Config_CCD_CCD
1860        FOREIGN KEY (ccdId) REFERENCES prv_CCD (ccdId);
1861
1862ALTER TABLE prv_Amplifier ADD CONSTRAINT FK_Amplifier_CCD
1863        FOREIGN KEY (ccdId) REFERENCES prv_CCD (ccdId);
1864
1865ALTER TABLE prv_cnf_Stage2Pipeline ADD CONSTRAINT FK_Config_Stage2Pipeline_Stage2Pipeline
1866        FOREIGN KEY (stage2pipelineId) REFERENCES prv_Stage2Pipeline (stage2pipelineId);
1867
1868ALTER TABLE prv_cnf_Pipeline2Run ADD CONSTRAINT FK_Config_Pipeline2Run_Pipeline2Run
1869        FOREIGN KEY (pipeline2runId) REFERENCES prv_Pipeline2Run (pipeline2runId);
1870
1871ALTER TABLE Raw_FPA_Exposure ADD CONSTRAINT FK_FPAExposure_Filter_filterId
1872        FOREIGN KEY (filterId) REFERENCES prv_Filter (filterId);
1873
1874ALTER TABLE prv_Stage2ProcHistory ADD CONSTRAINT FK_prv_Stage2ProcHistory_prv_ProcHistory
1875        FOREIGN KEY (procHistoryId) REFERENCES prv_ProcHistory (procHistoryId);
1876
1877ALTER TABLE prv_cnf_Telescope ADD CONSTRAINT FK_Config_Telescope_Telescope
1878        FOREIGN KEY (telescopeId) REFERENCES prv_Telescope (telescopeId);
1879
1880ALTER TABLE prv_cnf_Raft ADD CONSTRAINT FK_Config_Raft_Raft
1881        FOREIGN KEY (raftId) REFERENCES prv_Raft (raftId);
1882
1883ALTER TABLE prv_cnf_Filter ADD CONSTRAINT FK_Config_Filter_Filter
1884        FOREIGN KEY (filterId) REFERENCES prv_Filter (filterId);
1885
1886ALTER TABLE prv_CCD ADD CONSTRAINT FK_CCD_Raft
1887        FOREIGN KEY (raftId) REFERENCES prv_Raft (raftId);
1888
1889ALTER TABLE prv_Stage2UpdatableColumn ADD CONSTRAINT FK_Stage2UpdatableColumn_Config_Stage2UpdatableColumn
1890        FOREIGN KEY (cStage2UpdateColumnId) REFERENCES prv_cnf_Stage2UpdatableColumn (c_stage2UpdatableColumn);
1891
1892ALTER TABLE prv_Stage2UpdatableColumn ADD CONSTRAINT FK_Stage2UpdatableColumn_UpdatableColumn
1893        FOREIGN KEY (columnId) REFERENCES prv_UpdatableColumn (columnId);
1894
1895ALTER TABLE prv_Pipeline2Run ADD CONSTRAINT FK_Pipeline2Run_Pipeline
1896        FOREIGN KEY (pipelineId) REFERENCES prv_Pipeline (pipelineId);
1897
1898ALTER TABLE prv_Pipeline2Run ADD CONSTRAINT FK_Pipeline2Run_Run
1899        FOREIGN KEY (runId) REFERENCES prv_Run (runId);
1900
1901ALTER TABLE prv_cnf_Stage2Slice ADD CONSTRAINT FK_Config_Stage2Slice_Stage2Slice
1902        FOREIGN KEY (stage2sliceId) REFERENCES prv_Stage2Slice (stage2SliceId);
1903
1904ALTER TABLE prv_cnf_Slice ADD CONSTRAINT FK_Config_Slice_Node
1905        FOREIGN KEY (nodeId) REFERENCES prv_Node (nodeId);
1906
1907ALTER TABLE prv_cnf_Slice ADD CONSTRAINT FK_Config_Slice_Slice
1908        FOREIGN KEY (sliceId) REFERENCES prv_Slice (sliceId);
1909
1910ALTER TABLE prv_cnf_Node ADD CONSTRAINT FK_Config_Node_Node
1911        FOREIGN KEY (nodeId) REFERENCES prv_Node (nodeId);
1912
1913ALTER TABLE _Science_FPA_Exposure2TemplateImage ADD CONSTRAINT FK_Exposure2TemplateImage_TemplateImage_templateImageId
1914        FOREIGN KEY (templateImageId) REFERENCES TemplateImage (templateImageId);
1915
1916ALTER TABLE _Science_FPA_Exposure_Group ADD CONSTRAINT FK_CalibratedScienceExposure_Group_CMBiasExposure
1917        FOREIGN KEY (cmBiasExposureId) REFERENCES Bias_FPA_CMExposure (cmBiasExposureId);
1918
1919ALTER TABLE _Science_FPA_Exposure_Group ADD CONSTRAINT FK_CalibratedScienceExposure_Group_CMDarkExposure
1920        FOREIGN KEY (cmDarkExposureId) REFERENCES Dark_FPA_CMExposure (cmDarkExposureId);
1921
1922ALTER TABLE _FPA_Fringe2CMExposure ADD CONSTRAINT FK_CMFringeExposure_BiasExposure
1923        FOREIGN KEY (biasExposureId) REFERENCES Bias_FPA_Exposure (biasExposureId);
1924
1925ALTER TABLE _FPA_Fringe2CMExposure ADD CONSTRAINT FK_CMFringeExposure_CMFringeExposure
1926        FOREIGN KEY (cmFringeExposureId) REFERENCES Fringe_FPA_CMExposure (cdFringeExposureId);
1927
1928ALTER TABLE _FPA_Fringe2CMExposure ADD CONSTRAINT FK_CMFringeExposure_DarkExposure
1929        FOREIGN KEY (darkExposureId) REFERENCES Dark_FPA_Exposure (darkExposureId);
1930
1931ALTER TABLE _FPA_Fringe2CMExposure ADD CONSTRAINT FK_CMFringeExposure_FlatExposure
1932        FOREIGN KEY (flatExposureId) REFERENCES Flat_FPA_Exposure (flatExposureId);
1933
1934ALTER TABLE _SourceClassif2Descr ADD CONSTRAINT FK_SourceClassif2Descr_SourceClassif
1935        FOREIGN KEY (scId) REFERENCES SourceClassif (scId);
1936
1937ALTER TABLE _SourceClassif2Descr ADD CONSTRAINT FK_SourceClassif2Descr_SourceClassifAttr
1938        FOREIGN KEY (scAttrId) REFERENCES SourceClassifAttr (scAttrId);
1939
1940ALTER TABLE _SourceClassif2Descr ADD CONSTRAINT FK_SourceClassif2Descr_SourceClassifDescr
1941        FOREIGN KEY (scDescrId) REFERENCES SourceClassifDescr (scDescrId);
1942
1943ALTER TABLE _Object2Type ADD CONSTRAINT FK_Object2Type_Object
1944        FOREIGN KEY (objectId) REFERENCES Object (latestObsTime);
1945
1946ALTER TABLE _Object2Type ADD CONSTRAINT FK_Object2Type_ObjectType
1947        FOREIGN KEY (typeId) REFERENCES ObjectType (typeId);
1948
1949ALTER TABLE _MovingObject2Type ADD CONSTRAINT FK_MovingObject2Type_MovingObject
1950        FOREIGN KEY (movingObjectId) REFERENCES MovingObject (movingObjectId);
1951
1952ALTER TABLE _MovingObject2Type ADD CONSTRAINT FK_MovingObject2Type_ObjectType
1953        FOREIGN KEY (typeId) REFERENCES ObjectType (typeId);
1954
1955ALTER TABLE _Alert2Type ADD CONSTRAINT FK_Alert2Type_Alert_alertId
1956        FOREIGN KEY (alertId) REFERENCES Alert (timeGenerated);
1957
1958ALTER TABLE _Alert2Type ADD CONSTRAINT FK_Alert2Type_AlertType_alertTypeId
1959        FOREIGN KEY (alertTypeId) REFERENCES AlertType (alertTypeId);
1960
1961ALTER TABLE prv_UpdatableColumn ADD CONSTRAINT FK_UpdatableColumn_UpdatableTable
1962        FOREIGN KEY (tableId) REFERENCES prv_UpdatableTable (tableId);
1963
1964ALTER TABLE prv_Telescope ADD CONSTRAINT FK_Telescope_FocalPlane
1965        FOREIGN KEY (focalPlaneId) REFERENCES prv_FocalPlane (focalPlaneId);
1966
1967ALTER TABLE prv_Raft ADD CONSTRAINT FK_Raft_FocalPlane
1968        FOREIGN KEY (focalPlaneId) REFERENCES prv_FocalPlane (focalPlaneId);
1969
1970ALTER TABLE prv_Filter ADD CONSTRAINT FK_Filter_FocalPlane
1971        FOREIGN KEY (focalPlaneId) REFERENCES prv_FocalPlane (focalPlaneId);
1972
1973ALTER TABLE prv_cnf_FocalPlane ADD CONSTRAINT FK_Config_FocalPlane_FocalPlane
1974        FOREIGN KEY (focalPlaneId) REFERENCES prv_FocalPlane (focalPlaneId);
1975
1976ALTER TABLE prv_Stage2Slice ADD CONSTRAINT FK_ProcStep2Stage_ProcStep
1977        FOREIGN KEY (sliceId) REFERENCES prv_Slice (sliceId);
1978
1979ALTER TABLE prv_Stage ADD CONSTRAINT FK_Stage_Policy
1980        FOREIGN KEY (policyId) REFERENCES prv_Policy (policyId);
1981
1982ALTER TABLE prv_Run ADD CONSTRAINT FK_Run_Policy
1983        FOREIGN KEY (policyId) REFERENCES prv_Policy (policyId);
1984
1985ALTER TABLE prv_Pipeline ADD CONSTRAINT FK_Pipeline_Policy
1986        FOREIGN KEY (policyId) REFERENCES prv_Policy (policyId);
1987
1988ALTER TABLE prv_Node ADD CONSTRAINT FK_Node_Policy
1989        FOREIGN KEY (policyId) REFERENCES prv_Policy (policyId);