db.sql 23.4 KB
Newer Older
Wei Shoulin's avatar
Wei Shoulin committed
1
2
/*----------------facility------------------------------*/
drop table if exists t_module_status;
Wei Shoulin's avatar
c3    
Wei Shoulin committed
3

Wei Shoulin's avatar
Wei Shoulin committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
drop table if exists t_observation;

drop table if exists t_detector;

drop table if exists t_detector_status;

drop table if exists t_facility_status;

drop table if exists t_guiding;

/*----------------msc------------------------------*/
drop table if exists msc_level0_data;

drop table if exists msc_level0_header;

drop table if exists msc_level0_prc;

drop table if exists msc_cal2level0;

drop table if exists msc_cal_header;

drop table if exists msc_cal_merge;
Wei Shoulin's avatar
c3    
Wei Shoulin committed
26
27
28
29
30

drop table if exists msc_level1_data;

drop table if exists msc_level1_header;

Wei Shoulin's avatar
Wei Shoulin committed
31
drop table if exists msc_level1_prc;
Wei Shoulin's avatar
c3    
Wei Shoulin committed
32

Wei Shoulin's avatar
Wei Shoulin committed
33
drop table if exists msc_level1_ref;
Wei Shoulin's avatar
ifs ver    
Wei Shoulin committed
34
35
36
37
38
39

drop table if exists msc_level2_data;

drop table if exists msc_level2_header;

drop table if exists msc_level2_catalog;
Wei Shoulin's avatar
Wei Shoulin committed
40
/*----------------ifs------------------------------*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
41

Wei Shoulin's avatar
Wei Shoulin committed
42
drop table if exists ifs_level0_data;
Wei Shoulin's avatar
c3    
Wei Shoulin committed
43

Wei Shoulin's avatar
Wei Shoulin committed
44
drop table if exists ifs_level0_header;
Wei Shoulin's avatar
c3    
Wei Shoulin committed
45

Wei Shoulin's avatar
Wei Shoulin committed
46
drop table if exists ifs_level0_prc;
Wei Shoulin's avatar
c3    
Wei Shoulin committed
47

Wei Shoulin's avatar
Wei Shoulin committed
48
drop table if exists ifs_cal2level0;
Wei Shoulin's avatar
c3    
Wei Shoulin committed
49

Wei Shoulin's avatar
Wei Shoulin committed
50
drop table if exists ifs_cal_header;
Wei Shoulin's avatar
c3    
Wei Shoulin committed
51

Wei Shoulin's avatar
Wei Shoulin committed
52
drop table if exists ifs_cal_merge;
Wei Shoulin's avatar
c3    
Wei Shoulin committed
53

Wei Shoulin's avatar
Wei Shoulin committed
54
drop table if exists ifs_level1_data;
Wei Shoulin's avatar
c3    
Wei Shoulin committed
55

Wei Shoulin's avatar
Wei Shoulin committed
56
drop table if exists ifs_level1_header;
Wei Shoulin's avatar
c3    
Wei Shoulin committed
57

Wei Shoulin's avatar
Wei Shoulin committed
58
drop table if exists ifs_level1_prc;
Wei Shoulin's avatar
c3    
Wei Shoulin committed
59

Wei Shoulin's avatar
Wei Shoulin committed
60
drop table if exists ifs_level1_ref;
Wei Shoulin's avatar
mci 0-1    
Wei Shoulin committed
61
/*----------------mci------------------------------*/
Wei Shoulin's avatar
Wei Shoulin committed
62

Wei Shoulin's avatar
mci 0-1    
Wei Shoulin committed
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
drop table if exists mci_level0_data;

drop table if exists mci_level0_header;

drop table if exists mci_level0_prc;

drop table if exists mci_cal2level0;

drop table if exists mci_cal_header;

drop table if exists mci_cal_merge;

drop table if exists mci_level1_data;

drop table if exists mci_level1_header;

drop table if exists mci_level1_prc;

drop table if exists mci_level1_ref;
Wei Shoulin's avatar
Wei Shoulin committed
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*----------------sls------------------------------*/
drop table if exists sls_level0_data;

drop table if exists sls_level0_header;

drop table if exists sls_level0_prc;

drop table if exists sls_cal2level0;

drop table if exists sls_cal_header;

drop table if exists sls_cal_merge;

drop table if exists sls_level1_data;

drop table if exists sls_level1_header;

drop table if exists sls_level1_prc;

drop table if exists sls_level1_ref;

drop table if exists sls_level2_spectra;

/*===========================facility===================================*/
create table t_detector
(
   no                   varchar(10) not null,
   detector_name        varchar(256) not null,
   module_id            varchar(20),
   filter_id            varchar(20),
   create_time          datetime,
   update_time          datetime,
   primary key (no)
);
Wei Shoulin's avatar
Wei Shoulin committed
116
/*==============================================================*/
Wei Shoulin's avatar
Wei Shoulin committed
117
/* Table: t_detector_status                                     */
Wei Shoulin's avatar
Wei Shoulin committed
118
/*==============================================================*/
Wei Shoulin's avatar
Wei Shoulin committed
119
create table t_detector_status
Wei Shoulin's avatar
Wei Shoulin committed
120
121
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
122
123
124
125
   detector_no          varchar(10) not null,
   status               varchar(256) not null,
   status_time          datetime,
   create_time          datetime
Wei Shoulin's avatar
Wei Shoulin committed
126
);
Wei Shoulin's avatar
Wei Shoulin committed
127

Wei Shoulin's avatar
Wei Shoulin committed
128
/*==============================================================*/
Wei Shoulin's avatar
Wei Shoulin committed
129
/* Table: t_facility_status                                     */
Wei Shoulin's avatar
Wei Shoulin committed
130
/*==============================================================*/
Wei Shoulin's avatar
Wei Shoulin committed
131
132
133
134
135
136
create table t_facility_status
(
   id                   integer PRIMARY KEY autoincrement,
   status               varchar(256) not null,
   status_time          datetime,
   create_time          datetime
Wei Shoulin's avatar
Wei Shoulin committed
137
);
Wei Shoulin's avatar
Wei Shoulin committed
138

Wei Shoulin's avatar
Wei Shoulin committed
139
/*==============================================================*/
Wei Shoulin's avatar
Wei Shoulin committed
140
/* Table: t_guiding                                             */
Wei Shoulin's avatar
Wei Shoulin committed
141
/*==============================================================*/
Wei Shoulin's avatar
Wei Shoulin committed
142
create table t_guiding
Wei Shoulin's avatar
Wei Shoulin committed
143
(
Wei Shoulin's avatar
Wei Shoulin committed
144
145
146
147
148
   id                   integer PRIMARY KEY autoincrement,
   filename             varbinary(128),
   guiding_file_path    varchar(256) not null,
   guiding_no           varchar(256),
   create_time          datetime
Wei Shoulin's avatar
Wei Shoulin committed
149
150
);
/*==============================================================*/
Wei Shoulin's avatar
Wei Shoulin committed
151
/* Table: t_module_status                                       */
Wei Shoulin's avatar
Wei Shoulin committed
152
/*==============================================================*/
Wei Shoulin's avatar
Wei Shoulin committed
153
create table t_module_status
Wei Shoulin's avatar
Wei Shoulin committed
154
155
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
   module_id            varbinary(20),
   status               varchar(256) not null,
   status_time          datetime,
   create_time          datetime
);

/*==============================================================*/
/* Table: t_observation                                         */
/*==============================================================*/
create table t_observation
(
   id                   integer PRIMARY KEY autoincrement,
   obs_id               varchar(10),
   obs_time             datetime,
   exp_time             float,
   module_id            varchar(20),
   obs_type             varchar(16),
   facility_status_id   int(20),
   module_status_id     int(20),
   qc0_status           tinyint(1),
   qc0_time             datetime,
Wei Shoulin's avatar
Wei Shoulin committed
177
178
179
   prc_status           tinyint(1),
   prc_time             datetime,
   create_time          datetime,
Wei Shoulin's avatar
Wei Shoulin committed
180
   import_status        tinyint(1)
Wei Shoulin's avatar
Wei Shoulin committed
181
);
Wei Shoulin's avatar
Wei Shoulin committed
182
183
184

/*===========================msc===================================*/
create table msc_level0_data
Wei Shoulin's avatar
c3    
Wei Shoulin committed
185
186
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
187
   level0_id            varchar(20) not null,
Wei Shoulin's avatar
Wei Shoulin committed
188
189
190
191
192
193
   obs_id               varchar(10) not null,
   detector_no          varchar(10) not null,
   obs_type             varchar(16),
   obs_time             datetime,
   exp_time             float,
   detector_status_id   int(20),
Wei Shoulin's avatar
c3    
Wei Shoulin committed
194
195
   filename             varchar(128),
   file_path            varchar(256),
Wei Shoulin's avatar
Wei Shoulin committed
196
197
   qc0_status           tinyint(1),
   qc0_time             datetime,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
198
199
   prc_status           tinyint(1),
   prc_time             datetime,
Wei Shoulin's avatar
Wei Shoulin committed
200
   create_time          datetime
Wei Shoulin's avatar
Wei Shoulin committed
201
);
Wei Shoulin's avatar
Wei Shoulin committed
202
203

create table msc_level0_header
Wei Shoulin's avatar
c3    
Wei Shoulin committed
204
205
(
   id                   int(20) not null,
206
207
208
209
210
211
212
213
214
215
216
217
   ra_obj               float,
   dec_obj              float,
   crpix1               float,
   crpix2               float,
   crval1               float,
   crval2               float,
   ctype1               varchar(10),
   ctype2               varchar(10),
   cd1_1                float,
   cd1_2                float,
   cd2_1                float,
   cd2_2                float,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
218
219
220
221
   create_time          datetime,
   primary key (id)
);

Wei Shoulin's avatar
Wei Shoulin committed
222
223
224
225
226
227
228
229
230
231
232
create table msc_level0_prc
(
   id                   integer PRIMARY KEY autoincrement,
   level0_id            varchar(20) not null,
   pipeline_id          varchar(64) not null,
   prc_module           varchar(32) not null,
   params_file_path     varchar(256),
   prc_status           int(2),
   prc_time             datetime,
   result_file_path            varchar(256)
);
Wei Shoulin's avatar
c3    
Wei Shoulin committed
233
234
235
create table msc_level1_data
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
236
   level0_id            varchar(20) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
237
238
239
240
241
242
243
244
245
246
247
   data_type            varchar(64) not null,
   cor_sci_id           int(20),
   prc_params           varchar(1024),
   filename             varchar(128),
   file_path            varchar(256),
   prc_status           tinyint(1),
   prc_time             datetime,
   qc1_status           tinyint(1),
   qc1_time             datetime,
   create_time          datetime,
   pipeline_id          varchar(60)
Wei Shoulin's avatar
Wei Shoulin committed
248
);
Wei Shoulin's avatar
Wei Shoulin committed
249
250
251
252
253
254
create table msc_level1_ref (
  level1_id int(20) not null,
  ref_type varchar(64) not null,
  cal_id int(20) not null,
  primary key (level1_id, ref_type)
);
Wei Shoulin's avatar
c3    
Wei Shoulin committed
255
256
257
258
259
260
261
create table msc_level1_header
(
   id                   int(20) not null,
   ra                   float,
   "dec"                float,
   create_time          datetime,
   primary key (id)
Wei Shoulin's avatar
Wei Shoulin committed
262
);
Wei Shoulin's avatar
Wei Shoulin committed
263
create table msc_cal2level0
Wei Shoulin's avatar
c3    
Wei Shoulin committed
264
265
(
   merge_id             int(20) not null,
Wei Shoulin's avatar
Wei Shoulin committed
266
   level0_id            varchar(20) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
267
   primary key (merge_id, level0_id)
Wei Shoulin's avatar
Wei Shoulin committed
268
269
);

Wei Shoulin's avatar
Wei Shoulin committed
270
create table msc_cal_header
Wei Shoulin's avatar
c3    
Wei Shoulin committed
271
272
273
274
275
276
(
   id                   int(20) not null,
   ra                   float,
   "dec"                float,
   create_time          datetime,
   primary key (id)
Wei Shoulin's avatar
Wei Shoulin committed
277
278
);

Wei Shoulin's avatar
Wei Shoulin committed
279
create table msc_cal_merge
Wei Shoulin's avatar
c3    
Wei Shoulin committed
280
281
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
282
283
   cal_id               varchar(20) not null,
   detector_no          varchar(10) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
284
285
286
287
288
289
290
291
292
293
   ref_type             varchar(16),
   obs_time             datetime,
   exp_time             float,
   filename             varchar(128),
   file_path            varchar(256),
   qc1_status           tinyint(1),
   qc1_time             datetime,
   prc_status           tinyint(1),
   prc_time             datetime,
   create_time          datetime
Wei Shoulin's avatar
Wei Shoulin committed
294
);
Wei Shoulin's avatar
Wei Shoulin committed
295
296
297
298
299
300
301
302
303
304
305
create table msc_level1_prc
(
   id                   integer PRIMARY KEY autoincrement,
   level1_id            int(20) not null,
   pipeline_id          varchar(64) not null,
   prc_module           varchar(32) not null,
   params_file_path     varchar(256),
   prc_status           int(2),
   prc_time             datetime,
   result_file_path            varchar(256)
);
Wei Shoulin's avatar
ifs ver    
Wei Shoulin committed
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325

create table msc_level2_data (
   id integer PRIMARY KEY autoincrement,
   level1_id            int(20)          not null,
   data_type            VARCHAR(64)          not null,
   filename             VARCHAR(128)         null,
   file_path            VARCHAR(256)         null,
   prc_status           tinyint(1),
   prc_time             datetime                 null,
   qc2_status           tinyint(1),
   qc2_time             datetime                 null,
   create_time          datetime                 null
);

create table msc_level2_header (
   id                   BIGINT                 not null,
   ra                   float8               null,
   "dec"                float8               null,
   constraint PK_MSC_LEVEL2_HEADER primary key (id)
);
Wei Shoulin's avatar
Wei Shoulin committed
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
/*===========================ifs===================================*/
create table ifs_level0_data
(
   id                   integer PRIMARY KEY autoincrement,
   level0_id            varchar(20) not null,
   obs_id               varchar(10) not null,
   detector_no          varchar(10) not null,
   obs_type             varchar(16),
   obs_time             datetime,
   exp_time             float,
   detector_status_id   int(20),
   filename             varchar(128),
   file_path            varchar(256),
   qc0_status           tinyint(1),
   qc0_time             datetime,
   prc_status           tinyint(1),
   prc_time             datetime,
   create_time          datetime
);
Wei Shoulin's avatar
Wei Shoulin committed
345

Wei Shoulin's avatar
Wei Shoulin committed
346
create table ifs_level0_header
Wei Shoulin's avatar
c3    
Wei Shoulin committed
347
(
Wei Shoulin's avatar
Wei Shoulin committed
348
349
350
   id                   int(20) not null,
   ra                   float,
   "dec"                float,
Wei Shoulin's avatar
ifs ver    
Wei Shoulin committed
351
352
   object_name          varchar(64) not null,
   version              varchar(64) not null,
Wei Shoulin's avatar
Wei Shoulin committed
353
   primary key (id)
Wei Shoulin's avatar
Wei Shoulin committed
354
);
Wei Shoulin's avatar
c3    
Wei Shoulin committed
355

Wei Shoulin's avatar
Wei Shoulin committed
356
create table ifs_level0_prc
Wei Shoulin's avatar
c3    
Wei Shoulin committed
357
358
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
359
360
361
362
363
364
365
366
367
368
369
370
371
   level0_id            varchar(20) not null,
   pipeline_id          varchar(64) not null,
   prc_module           varchar(32) not null,
   params_file_path     varchar(256),
   prc_status           int(2),
   prc_time             datetime,
   result_file_path            varchar(256)
);
create table ifs_cal2level0
(
   merge_id             int(20) not null,
   level0_id            varchar(20) not null,
   primary key (merge_id, level0_id)
Wei Shoulin's avatar
c3    
Wei Shoulin committed
372
373
);

Wei Shoulin's avatar
Wei Shoulin committed
374
375
376
377
378
379
380
381
382
383
create table ifs_cal_header
(
   id                   int(20) not null,
   ra                   float,
   "dec"                float,
   create_time          datetime,
   primary key (id)
);

create table ifs_cal_merge
Wei Shoulin's avatar
c3    
Wei Shoulin committed
384
385
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
386
387
388
389
390
391
392
393
394
395
396
   cal_id               varchar(20) not null,
   detector_no          varchar(10) not null,
   ref_type             varchar(16),
   obs_time             datetime,
   exp_time             float,
   filename             varchar(128),
   file_path            varchar(256),
   qc1_status           tinyint(1),
   qc1_time             datetime,
   prc_status           tinyint(1),
   prc_time             datetime,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
397
398
399
   create_time          datetime
);

Wei Shoulin's avatar
Wei Shoulin committed
400
create table ifs_level1_data
Wei Shoulin's avatar
c3    
Wei Shoulin committed
401
402
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
403
404
405
406
407
408
409
410
411
412
413
414
   level0_id            varchar(20) not null,
   data_type            varchar(64) not null,
   cor_sci_id           int(20),
   prc_params           varchar(1024),
   filename             varchar(128),
   file_path            varchar(256),
   prc_status           tinyint(1),
   prc_time             datetime,
   qc1_status           tinyint(1),
   qc1_time             datetime,
   create_time          datetime,
   pipeline_id          varchar(60)
Wei Shoulin's avatar
c3    
Wei Shoulin committed
415
416
);

Wei Shoulin's avatar
Wei Shoulin committed
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
create table ifs_level1_ref (
  level1_id int(20) not null,
  ref_type varchar(64) not null,
  cal_id int(20) not null,
  primary key (level1_id, ref_type)
);

create table ifs_level1_header
(
   id                   int(20) not null,
   ra                   float,
   "dec"                float,
   create_time          datetime,
   primary key (id)
);
create table ifs_level1_prc
(
   id                   integer PRIMARY KEY autoincrement,
   level1_id            int(20) not null,
   pipeline_id          varchar(64) not null,
   prc_module           varchar(32) not null,
   params_file_path     varchar(256),
   prc_status           int(2),
   prc_time             datetime,
   result_file_path            varchar(256)
);
Wei Shoulin's avatar
mci 0-1    
Wei Shoulin committed
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
/*===========================mci===================================*/
create table mci_level0_data
(
   id                   integer PRIMARY KEY autoincrement,
   level0_id            varchar(20) not null,
   obs_id               varchar(10) not null,
   detector_no          varchar(10) not null,
   obs_type             varchar(16),
   obs_time             datetime,
   exp_time             float,
   detector_status_id   int(20),
   filename             varchar(128),
   file_path            varchar(256),
   qc0_status           tinyint(1),
   qc0_time             datetime,
   prc_status           tinyint(1),
   prc_time             datetime,
   create_time          datetime
);

create table mci_level0_header
(
   id                   int(20) not null,
   ra                   float,
   "dec"                float,
Wei Shoulin's avatar
ifs ver    
Wei Shoulin committed
468
469
   object_name          varchar(64) not null,
   version              varchar(64) not null,
Wei Shoulin's avatar
mci 0-1    
Wei Shoulin committed
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
   primary key (id)
);

create table mci_level0_prc
(
   id                   integer PRIMARY KEY autoincrement,
   level0_id            varchar(20) not null,
   pipeline_id          varchar(64) not null,
   prc_module           varchar(32) not null,
   params_file_path     varchar(256),
   prc_status           int(2),
   prc_time             datetime,
   result_file_path            varchar(256)
);
create table mci_cal2level0
(
   merge_id             int(20) not null,
   level0_id            varchar(20) not null,
   primary key (merge_id, level0_id)
);

create table mci_cal_header
(
   id                   int(20) not null,
   ra                   float,
   "dec"                float,
   create_time          datetime,
   primary key (id)
);

create table mci_cal_merge
(
   id                   integer PRIMARY KEY autoincrement,
   cal_id               varchar(20) not null,
   detector_no          varchar(10) not null,
   ref_type             varchar(16),
   obs_time             datetime,
   exp_time             float,
   filename             varchar(128),
   file_path            varchar(256),
   qc1_status           tinyint(1),
   qc1_time             datetime,
   prc_status           tinyint(1),
   prc_time             datetime,
   create_time          datetime
);

create table mci_level1_data
(
   id                   integer PRIMARY KEY autoincrement,
   level0_id            varchar(20) not null,
   data_type            varchar(64) not null,
   cor_sci_id           int(20),
   prc_params           varchar(1024),
   filename             varchar(128),
   file_path            varchar(256),
   prc_status           tinyint(1),
   prc_time             datetime,
   qc1_status           tinyint(1),
   qc1_time             datetime,
   create_time          datetime,
   pipeline_id          varchar(60)
);

create table mci_level1_ref (
  level1_id int(20) not null,
  ref_type varchar(64) not null,
  cal_id int(20) not null,
  primary key (level1_id, ref_type)
);

create table mci_level1_header
(
   id                   int(20) not null,
   ra                   float,
   "dec"                float,
   create_time          datetime,
   primary key (id)
);
create table mci_level1_prc
(
   id                   integer PRIMARY KEY autoincrement,
   level1_id            int(20) not null,
   pipeline_id          varchar(64) not null,
   prc_module           varchar(32) not null,
   params_file_path     varchar(256),
   prc_status           int(2),
   prc_time             datetime,
   result_file_path            varchar(256)
);
Wei Shoulin's avatar
Wei Shoulin committed
560
561
/*===========================sls===================================*/
create table sls_level0_data
Wei Shoulin's avatar
c3    
Wei Shoulin committed
562
563
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
564
565
566
   level0_id            varchar(20) not null,
   obs_id               varchar(10) not null,
   detector_no          varchar(10) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
567
568
569
570
571
572
573
574
575
576
577
578
579
   obs_type             varchar(16),
   obs_time             datetime,
   exp_time             float,
   detector_status_id   int(20),
   filename             varchar(128),
   file_path            varchar(256),
   qc0_status           tinyint(1),
   qc0_time             datetime,
   prc_status           tinyint(1),
   prc_time             datetime,
   create_time          datetime
);

Wei Shoulin's avatar
Wei Shoulin committed
580
create table sls_level0_header
Wei Shoulin's avatar
c3    
Wei Shoulin committed
581
582
583
584
585
586
587
588
(
   id                   int(20) not null,
   ra                   float,
   "dec"                float,
   create_time          datetime,
   primary key (id)
);

Wei Shoulin's avatar
Wei Shoulin committed
589
create table sls_level0_prc
Wei Shoulin's avatar
c3    
Wei Shoulin committed
590
591
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
592
   level0_id            varchar(20) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
593
594
   pipeline_id          varchar(64) not null,
   prc_module           varchar(32) not null,
Wei Shoulin's avatar
Wei Shoulin committed
595
   params_file_path     varchar(256),
Wei Shoulin's avatar
c3    
Wei Shoulin committed
596
597
   prc_status           int(2),
   prc_time             datetime,
Wei Shoulin's avatar
Wei Shoulin committed
598
   result_file_path            varchar(256)
Wei Shoulin's avatar
c3    
Wei Shoulin committed
599
);
Wei Shoulin's avatar
Wei Shoulin committed
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
create table sls_cal2level0
(
   merge_id             int(20) not null,
   level0_id            varchar(20) not null,
   primary key (merge_id, level0_id)
);

create table sls_cal_header
(
   id                   int(20) not null,
   ra                   float,
   "dec"                float,
   create_time          datetime,
   primary key (id)
);

create table sls_cal_merge
(
   id                   integer PRIMARY KEY autoincrement,
   cal_id               varchar(20) not null,
   detector_no          varchar(10) not null,
   ref_type             varchar(16),
   obs_time             datetime,
   exp_time             float,
   filename             varchar(128),
   file_path            varchar(256),
   qc1_status           tinyint(1),
   qc1_time             datetime,
   prc_status           tinyint(1),
   prc_time             datetime,
   create_time          datetime
);

create table sls_level1_data
(
   id                   integer PRIMARY KEY autoincrement,
   level0_id            varchar(20) not null,
   data_type            varchar(64) not null,
   prc_params           varchar(1024),
   filename             varchar(128),
   file_path            varchar(256),
   prc_status           tinyint(1),
   prc_time             datetime,
   qc1_status           tinyint(1),
   qc1_time             datetime,
   create_time          datetime,
   pipeline_id          varchar(60)
);

create table sls_level1_ref (
  level1_id int(20) not null,
  ref_type varchar(64) not null,
  cal_id int(20) not null,
  primary key (level1_id, ref_type)
);

create table sls_level1_header
(
   id                   int(20) not null,
   ra                   float,
   "dec"                float,
   create_time          datetime,
   primary key (id)
);

create table sls_level1_prc
Wei Shoulin's avatar
Wei Shoulin committed
666
667
668
669
670
671
672
673
(
   id                   integer PRIMARY KEY autoincrement,
   level1_id            int(20) not null,
   pipeline_id          varchar(64) not null,
   prc_module           varchar(32) not null,
   params_file_path     varchar(256),
   prc_status           int(2),
   prc_time             datetime,
Wei Shoulin's avatar
Wei Shoulin committed
674
   result_file_path     varchar(256)
Wei Shoulin's avatar
Wei Shoulin committed
675
);
Wei Shoulin's avatar
Wei Shoulin committed
676
677

create table sls_level2_spectra
Wei Shoulin's avatar
c3    
Wei Shoulin committed
678
679
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
680
681
682
683
684
685
686
687
688
689
690
   spectra_id           varchar(40),
   level1_id            int(20) not null,
   region               varchar(128),
   filename             varchar(128),
   file_path            varchar(256),
   prc_status           tinyint(1),
   prc_time             datetime,
   qc1_status           tinyint(1),
   qc1_time             datetime,
   create_time          datetime,
   pipeline_id          varchar(60)
Wei Shoulin's avatar
c3    
Wei Shoulin committed
691
);
Wei Shoulin's avatar
Wei Shoulin committed
692
create table sls_level2_spectra_header
Wei Shoulin's avatar
c3    
Wei Shoulin committed
693
(
Wei Shoulin's avatar
Wei Shoulin committed
694
   id                   int(20) not null,
Wei Shoulin's avatar
Wei Shoulin committed
695
696
697
698
699
700
701
702
703
704
705
706
707
   ra                   float,
   "dec"                float,
   create_time          datetime,
   primary key (id)
);
/*===========================cpic===================================*/
create table cpic_level0_data
(
   id                   integer PRIMARY KEY autoincrement,
   level0_id            varchar(20) not null,
   obs_id               varchar(10) not null,
   detector_no          varchar(10) not null,
   obs_type             varchar(16),
Wei Shoulin's avatar
c3    
Wei Shoulin committed
708
709
   obs_time             datetime,
   exp_time             float,
Wei Shoulin's avatar
Wei Shoulin committed
710
711
712
713
714
715
716
717
718
719
720
721
722
   detector_status_id   int(20),
   filename             varchar(128),
   file_path            varchar(256),
   qc0_status           tinyint(1),
   qc0_time             datetime,
   prc_status           tinyint(1),
   prc_time             datetime,
   create_time          datetime
);

create table cpic_level0_header
(
   id                   int(20) not null,
Wei Shoulin's avatar
Wei Shoulin committed
723
724
   ra                   float,
   "dec"                float,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
725
   create_time          datetime,
Wei Shoulin's avatar
Wei Shoulin committed
726
   primary key (id)
Wei Shoulin's avatar
c3    
Wei Shoulin committed
727
728
);

Wei Shoulin's avatar
Wei Shoulin committed
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
create table cpic_level0_prc
(
   id                   integer PRIMARY KEY autoincrement,
   level0_id            varchar(20) not null,
   pipeline_id          varchar(64) not null,
   prc_module           varchar(32) not null,
   params_file_path     varchar(256),
   prc_status           int(2),
   prc_time             datetime,
   result_file_path            varchar(256)
);
create table cpic_cal2level0
(
   merge_id             int(20) not null,
   level0_id            varchar(20) not null,
   primary key (merge_id, level0_id)
);

create table cpic_cal_header
(
   id                   int(20) not null,
   ra                   float,
   "dec"                float,
   create_time          datetime,
   primary key (id)
);

create table cpic_cal_merge
(
   id                   integer PRIMARY KEY autoincrement,
   cal_id               varchar(20) not null,
   detector_no          varchar(10) not null,
   ref_type             varchar(16),
   obs_time             datetime,
   exp_time             float,
   filename             varchar(128),
   file_path            varchar(256),
   qc1_status           tinyint(1),
   qc1_time             datetime,
   prc_status           tinyint(1),
   prc_time             datetime,
   create_time          datetime
);

create table cpic_level1_data
(
   id                   integer PRIMARY KEY autoincrement,
   level0_id            varchar(20) not null,
   data_type            varchar(64) not null,
   prc_params           varchar(1024),
   filename             varchar(128),
   file_path            varchar(256),
   prc_status           tinyint(1),
   prc_time             datetime,
   qc1_status           tinyint(1),
   qc1_time             datetime,
   create_time          datetime,
   pipeline_id          varchar(60)
);

create table cpic_level1_ref (
  level1_id int(20) not null,
  ref_type varchar(64) not null,
  cal_id int(20) not null,
  primary key (level1_id, ref_type)
);

create table cpic_level1_header
(
   id                   int(20) not null,
   ra                   float,
   "dec"                float,
   create_time          datetime,
   primary key (id)
);

create table cpic_level1_prc
(
   id                   integer PRIMARY KEY autoincrement,
   level1_id            int(20) not null,
   pipeline_id          varchar(64) not null,
   prc_module           varchar(32) not null,
   params_file_path     varchar(256),
   prc_status           int(2),
   prc_time             datetime,
   result_file_path     varchar(256)
);