db.sql 24.5 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
34
drop table if exists msc_level1_ref;
/*----------------ifs------------------------------*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
35

Wei Shoulin's avatar
Wei Shoulin committed
36
drop table if exists ifs_level0_data;
Wei Shoulin's avatar
c3    
Wei Shoulin committed
37

Wei Shoulin's avatar
Wei Shoulin committed
38
drop table if exists ifs_level0_header;
Wei Shoulin's avatar
c3    
Wei Shoulin committed
39

Wei Shoulin's avatar
Wei Shoulin committed
40
drop table if exists ifs_level0_prc;
Wei Shoulin's avatar
c3    
Wei Shoulin committed
41

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

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

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

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

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

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

Wei Shoulin's avatar
Wei Shoulin committed
54
drop table if exists ifs_level1_ref;
Wei Shoulin's avatar
mci 0-1    
Wei Shoulin committed
55
/*----------------mci------------------------------*/
Wei Shoulin's avatar
Wei Shoulin committed
56

Wei Shoulin's avatar
mci 0-1    
Wei Shoulin committed
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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
76
77
78
79
80
81
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
/*----------------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
110
/*==============================================================*/
Wei Shoulin's avatar
Wei Shoulin committed
111
/* Table: t_detector_status                                     */
Wei Shoulin's avatar
Wei Shoulin committed
112
/*==============================================================*/
Wei Shoulin's avatar
Wei Shoulin committed
113
create table t_detector_status
Wei Shoulin's avatar
Wei Shoulin committed
114
115
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
116
117
118
119
   detector_no          varchar(10) not null,
   status               varchar(256) not null,
   status_time          datetime,
   create_time          datetime
Wei Shoulin's avatar
Wei Shoulin committed
120
);
Wei Shoulin's avatar
Wei Shoulin committed
121

Wei Shoulin's avatar
Wei Shoulin committed
122
/*==============================================================*/
Wei Shoulin's avatar
Wei Shoulin committed
123
/* Table: t_facility_status                                     */
Wei Shoulin's avatar
Wei Shoulin committed
124
/*==============================================================*/
Wei Shoulin's avatar
Wei Shoulin committed
125
126
127
128
129
130
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
131
);
Wei Shoulin's avatar
Wei Shoulin committed
132

Wei Shoulin's avatar
Wei Shoulin committed
133
/*==============================================================*/
Wei Shoulin's avatar
Wei Shoulin committed
134
/* Table: t_guiding                                             */
Wei Shoulin's avatar
Wei Shoulin committed
135
/*==============================================================*/
Wei Shoulin's avatar
Wei Shoulin committed
136
create table t_guiding
Wei Shoulin's avatar
Wei Shoulin committed
137
(
Wei Shoulin's avatar
Wei Shoulin committed
138
139
140
141
142
   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
143
144
);
/*==============================================================*/
Wei Shoulin's avatar
Wei Shoulin committed
145
/* Table: t_module_status                                       */
Wei Shoulin's avatar
Wei Shoulin committed
146
/*==============================================================*/
Wei Shoulin's avatar
Wei Shoulin committed
147
create table t_module_status
Wei Shoulin's avatar
Wei Shoulin committed
148
149
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
   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
171
172
173
   prc_status           tinyint(1),
   prc_time             datetime,
   create_time          datetime,
Wei Shoulin's avatar
Wei Shoulin committed
174
   import_status        tinyint(1)
Wei Shoulin's avatar
Wei Shoulin committed
175
);
Wei Shoulin's avatar
Wei Shoulin committed
176
177
178

/*===========================msc===================================*/
create table msc_level0_data
Wei Shoulin's avatar
c3    
Wei Shoulin committed
179
180
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
181
   level0_id            varchar(20) not null,
Wei Shoulin's avatar
Wei Shoulin committed
182
183
184
185
186
187
   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
188
189
   filename             varchar(128),
   file_path            varchar(256),
Wei Shoulin's avatar
Wei Shoulin committed
190
191
   qc0_status           tinyint(1),
   qc0_time             datetime,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
192
193
   prc_status           tinyint(1),
   prc_time             datetime,
Wei Shoulin's avatar
Wei Shoulin committed
194
   create_time          datetime
Wei Shoulin's avatar
Wei Shoulin committed
195
);
Wei Shoulin's avatar
Wei Shoulin committed
196
197

create table msc_level0_header
Wei Shoulin's avatar
c3    
Wei Shoulin committed
198
199
200
201
202
203
204
205
206
207
(
   id                   int(20) not null,
   obs_time             datetime,
   exp_time             float,
   ra                   float,
   "dec"                float,
   create_time          datetime,
   primary key (id)
);

Wei Shoulin's avatar
Wei Shoulin committed
208
209
210
211
212
213
214
215
216
217
218
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
219
220
221
create table msc_level1_data
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
222
   level0_id            varchar(20) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
223
224
225
226
227
228
229
230
231
232
233
   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
234
);
Wei Shoulin's avatar
Wei Shoulin committed
235
236
237
238
239
240
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
241
242
243
244
245
246
247
248
249
create table msc_level1_header
(
   id                   int(20) not null,
   obs_time             datetime,
   exp_time             float,
   ra                   float,
   "dec"                float,
   create_time          datetime,
   primary key (id)
Wei Shoulin's avatar
Wei Shoulin committed
250
);
Wei Shoulin's avatar
Wei Shoulin committed
251
create table msc_cal2level0
Wei Shoulin's avatar
c3    
Wei Shoulin committed
252
253
(
   merge_id             int(20) not null,
Wei Shoulin's avatar
Wei Shoulin committed
254
   level0_id            varchar(20) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
255
   primary key (merge_id, level0_id)
Wei Shoulin's avatar
Wei Shoulin committed
256
257
);

Wei Shoulin's avatar
Wei Shoulin committed
258
create table msc_cal_header
Wei Shoulin's avatar
c3    
Wei Shoulin committed
259
260
261
262
263
264
265
266
(
   id                   int(20) not null,
   obs_time             datetime,
   exp_time             float,
   ra                   float,
   "dec"                float,
   create_time          datetime,
   primary key (id)
Wei Shoulin's avatar
Wei Shoulin committed
267
268
);

Wei Shoulin's avatar
Wei Shoulin committed
269
create table msc_cal_merge
Wei Shoulin's avatar
c3    
Wei Shoulin committed
270
271
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
272
273
   cal_id               varchar(20) not null,
   detector_no          varchar(10) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
274
275
276
277
278
279
280
281
282
283
   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
284
);
Wei Shoulin's avatar
Wei Shoulin committed
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
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)
);
/*===========================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
315

Wei Shoulin's avatar
Wei Shoulin committed
316
create table ifs_level0_header
Wei Shoulin's avatar
c3    
Wei Shoulin committed
317
(
Wei Shoulin's avatar
Wei Shoulin committed
318
319
320
321
322
   id                   int(20) not null,
   obs_time             datetime,
   exp_time             float,
   ra                   float,
   "dec"                float,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
323
   create_time          datetime,
Wei Shoulin's avatar
Wei Shoulin committed
324
   primary key (id)
Wei Shoulin's avatar
Wei Shoulin committed
325
);
Wei Shoulin's avatar
c3    
Wei Shoulin committed
326

Wei Shoulin's avatar
Wei Shoulin committed
327
create table ifs_level0_prc
Wei Shoulin's avatar
c3    
Wei Shoulin committed
328
329
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
330
331
332
333
334
335
336
337
338
339
340
341
342
   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
343
344
);

Wei Shoulin's avatar
Wei Shoulin committed
345
346
347
348
349
350
351
352
353
354
355
356
create table ifs_cal_header
(
   id                   int(20) not null,
   obs_time             datetime,
   exp_time             float,
   ra                   float,
   "dec"                float,
   create_time          datetime,
   primary key (id)
);

create table ifs_cal_merge
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
   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
370
371
372
   create_time          datetime
);

Wei Shoulin's avatar
Wei Shoulin committed
373
create table ifs_level1_data
Wei Shoulin's avatar
c3    
Wei Shoulin committed
374
375
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
376
377
378
379
380
381
382
383
384
385
386
387
   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
388
389
);

Wei Shoulin's avatar
Wei Shoulin committed
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
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,
   obs_time             datetime,
   exp_time             float,
   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
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
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
468
469
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
/*===========================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,
   obs_time             datetime,
   exp_time             float,
   ra                   float,
   "dec"                float,
   create_time          datetime,
   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,
   obs_time             datetime,
   exp_time             float,
   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,
   obs_time             datetime,
   exp_time             float,
   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
540
541
/*===========================sls===================================*/
create table sls_level0_data
Wei Shoulin's avatar
c3    
Wei Shoulin committed
542
543
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
544
545
546
   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
547
548
549
550
551
552
553
554
555
556
557
558
559
   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
560
create table sls_level0_header
Wei Shoulin's avatar
c3    
Wei Shoulin committed
561
562
563
564
565
566
567
568
569
570
(
   id                   int(20) not null,
   obs_time             datetime,
   exp_time             float,
   ra                   float,
   "dec"                float,
   create_time          datetime,
   primary key (id)
);

Wei Shoulin's avatar
Wei Shoulin committed
571
create table sls_level0_prc
Wei Shoulin's avatar
c3    
Wei Shoulin committed
572
573
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
574
   level0_id            varchar(20) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
575
576
   pipeline_id          varchar(64) not null,
   prc_module           varchar(32) not null,
Wei Shoulin's avatar
Wei Shoulin committed
577
   params_file_path     varchar(256),
Wei Shoulin's avatar
c3    
Wei Shoulin committed
578
579
   prc_status           int(2),
   prc_time             datetime,
Wei Shoulin's avatar
Wei Shoulin committed
580
   result_file_path            varchar(256)
Wei Shoulin's avatar
c3    
Wei Shoulin committed
581
);
Wei Shoulin's avatar
Wei Shoulin committed
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
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
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,
   obs_time             datetime,
   exp_time             float,
   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,
   obs_time             datetime,
   exp_time             float,
   ra                   float,
   "dec"                float,
   create_time          datetime,
   primary key (id)
);

create table sls_level1_prc
Wei Shoulin's avatar
Wei Shoulin committed
652
653
654
655
656
657
658
659
(
   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
660
   result_file_path     varchar(256)
Wei Shoulin's avatar
Wei Shoulin committed
661
);
Wei Shoulin's avatar
Wei Shoulin committed
662
663

create table sls_level2_spectra
Wei Shoulin's avatar
c3    
Wei Shoulin committed
664
665
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
666
667
668
669
670
671
672
673
674
675
676
   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
677
);
Wei Shoulin's avatar
Wei Shoulin committed
678
create table sls_level2_spectra_header
Wei Shoulin's avatar
c3    
Wei Shoulin committed
679
(
Wei Shoulin's avatar
Wei Shoulin committed
680
   id                   int(20) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
681
682
   obs_time             datetime,
   exp_time             float,
Wei Shoulin's avatar
Wei Shoulin committed
683
684
   ra                   float,
   "dec"                float,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
685
   create_time          datetime,
Wei Shoulin's avatar
Wei Shoulin committed
686
   primary key (id)
Wei Shoulin's avatar
c3    
Wei Shoulin committed
687
);
Wei Shoulin's avatar
Wei Shoulin committed
688
-- csst.msc_level2_catalog definition
Wei Shoulin's avatar
c3    
Wei Shoulin committed
689

Wei Shoulin's avatar
Wei Shoulin committed
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
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
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
CREATE TABLE msc_level2_catalog (
  source_id integer PRIMARY KEY autoincrement,
  obs_id varchar(12),
  detector_no char(2),
  seq int(20),
  flux_aper_1 double,
  flux_aper_2 double,
  flux_aper_3 double,
  flux_aper_4 double,
  flux_aper_5 double,
  flux_aper_6 double,
  flux_aper_7 double,
  flux_aper_8 double,
  flux_aper_9 double,
  flux_aper_10 double,
  flux_aper_11 double,
  flux_aper_12 double,
  fluxerr_aper_1 double,
  fluxerr_aper_2 double,
  fluxerr_aper_3 double,
  fluxerr_aper_4 double,
  fluxerr_aper_5 double,
  fluxerr_aper_6 double,
  fluxerr_aper_7 double,
  fluxerr_aper_8 double,
  fluxerr_aper_9 double,
  fluxerr_aper_10 double,
  fluxerr_aper_11 double,
  fluxerr_aper_12 double,
  mag_aper_1 double,
  mag_aper_2 double,
  mag_aper_3 double,
  mag_aper_4 double,
  mag_aper_5 double,
  mag_aper_6 double,
  mag_aper_7 double,
  mag_aper_8 double,
  mag_aper_9 double,
  mag_aper_10 double,
  mag_aper_11 double,
  mag_aper_12 double,
  magerr_aper_1 double,
  magerr_aper_2 double,
  magerr_aper_3 double,
  magerr_aper_4 double,
  magerr_aper_5 double,
  magerr_aper_6 double,
  magerr_aper_7 double,
  magerr_aper_8 double,
  magerr_aper_9 double,
  magerr_aper_10 double,
  magerr_aper_11 double,
  magerr_aper_12 double,
  flux_auto double,
  fluxerr_auto double,
  mag_auto double,
  magerr_auto double,
  kron_radius double,
  background double,
  x_image double,
  y_image double,
  alpha_j2000 double,
  delta_j2000 double,
  a_image double,
  b_image double,
  theta_image double,
  a_world double,
  b_world double,
  theta_world double,
  theta_j2000 double,
  errx2_image double,
  erry2_image double,
  erra_image double,
  errb_image double,
  errtheta_image double,
  erra_world double,
  errb_world double,
  errtheta_world double,
  errtheta_j2000 double,
  xwin_image double,
  ywin_image double,
  alphawin_j2000 double,
  deltawin_j2000 double,
  errx2win_image double,
  erry2win_image double,
  flags int(20),
  flags_weight int(20),
  imaflags_iso double,
  nimaflags_iso double,
  fwhm_image double,
  fwhm_world double,
  elongation double,
  ellipticity double,
  class_star double,
  flux_radius double,
  fwhmpsf_image double,
  fwhmpsf_world double,
  xpsf_image double,
  ypsf_image double,
  alphapsf_j2000 double,
  deltapsf_j2000 double,
  flux_psf double,
  fluxerr_psf double,
  mag_psf double,
  magerr_psf double,
  niter_psf int(20),
  chi2_psf double,
  errx2psf_image double,
  erry2psf_image double,
  chi2_model double,
  flags_model tinyint(1),
  niter_model int(20),
  flux_model double,
  fluxerr_model double,
  mag_model double,
  magerr_model double,
  flux_hybrid double,
  fluxerr_hybrid double,
  mag_hybrid double,
  magerr_hybrid double,
  flux_max_model double,
  mu_max_model double,
  flux_eff_model double,
  mu_eff_model double,
  flux_mean_model double,
  mu_mean_model double,
  xmodel_image double,
  ymodel_image double,
  alphamodel_j2000 double,
  deltamodel_j2000 double,
  erry2model_image double,
  erramodel_image double,
  errbmodel_image double,
  errthetamodel_image double,
  erramodel_world double,
  errbmodel_world double,
  errthetamodel_world double,
  errthetamodel_j2000 double,
  amodel_image double,
  bmodel_image double,
  thetamodel_image double,
  amodel_world double,
  bmodel_world double,
  thetamodel_world double,
  thetamodel_j2000 double,
  spread_model double,
  spreaderr_model double,
  noisearea_model double,
  flux_spheroid double,
  fluxerr_spheroid double,
  mag_spheroid double,
  magerr_spheroid double,
  flux_max_spheroid double,
  mu_max_spheroid double,
  flux_eff_spheroid double,
  mu_eff_spheroid double,
  flux_mean_spheroid double,
  mu_mean_spheroid double,
  fluxratio_spheroid double,
  fluxratioerr_spheroid double,
  spheroid_reff_image double,
  spheroid_refferr_image double,
  spheroid_reff_world double,
  spheroid_refferr_world double,
  spheroid_aspect_image double,
  spheroid_aspecterr_image double,
  spheroid_aspect_world double,
  spheroid_aspecterr_world double,
  spheroid_theta_image double,
  spheroid_thetaerr_image double,
  spheroid_theta_world double,
  spheroid_thetaerr_world double,
  spheroid_theta_j2000 double,
  spheroid_sersicn double,
  spheroid_sersicnerr double,
  flux_disk double,
  fluxerr_disk double,
  mag_disk double,
  magerr_disk double,
  flux_max_disk double,
  mu_max_disk double,
  flux_eff_disk double,
  mu_eff_disk double,
  flux_mean_disk double,
  mu_mean_disk double,
  fluxratio_disk double,
  fluxratioerr_disk double,
  disk_scale_image double,
  disk_scaleerr_image double,
  disk_scale_world double,
  disk_scaleerr_world double,
  disk_aspect_image double,
  disk_aspecterr_image double,
  disk_aspect_world double,
  disk_aspecterr_world double,
  disk_inclination double,
  disk_inclinationerr double,
  disk_theta_image double,
  disk_thetaerr_image double,
  disk_theta_world double,
  disk_thetaerr_world double,
  disk_theta_j2000 double,
  obs_time datetime
) ;