db.sql 12.6 KB
Newer Older
Wei Shoulin's avatar
c3    
Wei Shoulin committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
drop table if exists ifs_level1_data;

drop table if exists ifs_level1_header;

drop table if exists msc_level1_data;

drop table if exists msc_level1_header;

drop table if exists t_cal2level0;

drop table if exists t_cal_header;

drop table if exists t_cal_merge;

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;

drop table if exists t_level0_data;

drop table if exists t_level0_header;

drop table if exists t_level0_prc;

drop table if exists t_module_status;

drop table if exists t_observation;
Wei Shoulin's avatar
Wei Shoulin committed
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*==============================================================*/
/* Table: sls_level1_data                                       */
/*==============================================================*/
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)
);
/*==============================================================*/
/* Table: sls_level1_ref                                       */
/*==============================================================*/
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)
);
/*==============================================================*/
/* Table: sls_level1_header                                     */
/*==============================================================*/
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)
);
/*==============================================================*/
/* Table: sls_level2_spectra                                  */
/*==============================================================*/
create table sls_level2_spectra
(
   id                   integer PRIMARY KEY autoincrement,
   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
90
91
92
93
94
95
/*==============================================================*/
/* Table: ifs_level1_data                                       */
/*==============================================================*/
create table ifs_level1_data
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
96
   level0_id            varchar(20) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
97
98
99
100
101
102
103
104
105
106
107
108
   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
109
110
111
112
113
114
115
116
117
/*==============================================================*/
/* Table: ifs_level1_ref                                       */
/*==============================================================*/
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)
);
Wei Shoulin's avatar
c3    
Wei Shoulin committed
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*==============================================================*/
/* Table: ifs_level1_header                                     */
/*==============================================================*/
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)
);

Wei Shoulin's avatar
Wei Shoulin committed
132
/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
133
/* Table: msc_level1_data                                       */
Wei Shoulin's avatar
Wei Shoulin committed
134
/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
135
136
137
create table msc_level1_data
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
138
   level0_id            varchar(20) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
139
140
141
142
143
144
145
146
147
148
149
   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
150
);
Wei Shoulin's avatar
Wei Shoulin committed
151
152
153
154
155
156
157
158
159
/*==============================================================*/
/* Table: msc_level1_ref                                       */
/*==============================================================*/
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
Wei Shoulin committed
160
/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
161
/* Table: msc_level1_header                                     */
Wei Shoulin's avatar
Wei Shoulin committed
162
/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
163
164
165
166
167
168
169
170
171
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
172
173
174
);

/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
175
/* Table: t_cal2level0                                          */
Wei Shoulin's avatar
Wei Shoulin committed
176
/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
177
178
179
create table t_cal2level0
(
   merge_id             int(20) not null,
Wei Shoulin's avatar
Wei Shoulin committed
180
   level0_id            varchar(20) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
181
   primary key (merge_id, level0_id)
Wei Shoulin's avatar
Wei Shoulin committed
182
183
184
);

/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
185
/* Table: t_cal_header                                          */
Wei Shoulin's avatar
Wei Shoulin committed
186
/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
187
188
189
190
191
192
193
194
195
create table t_cal_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
196
197
198
);

/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
199
/* Table: t_cal_merge                                           */
Wei Shoulin's avatar
Wei Shoulin committed
200
/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
201
202
203
create table t_cal_merge
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
204
205
   cal_id               varchar(20) not null,
   detector_no          varchar(10) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
206
207
208
209
210
211
212
213
214
215
   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
216
217
218
);

/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
219
/* Table: t_detector                                            */
Wei Shoulin's avatar
Wei Shoulin committed
220
/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
221
222
create table t_detector
(
Wei Shoulin's avatar
Wei Shoulin committed
223
   no                   varchar(10) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
224
225
226
227
228
229
   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
230
);
Wei Shoulin's avatar
c3    
Wei Shoulin committed
231
232
233
234
235
236
237

/*==============================================================*/
/* Table: t_detector_status                                     */
/*==============================================================*/
create table t_detector_status
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
238
   detector_no          varchar(10) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
   status               varchar(256) not null,
   status_time          datetime,
   create_time          datetime
);

/*==============================================================*/
/* Table: t_facility_status                                     */
/*==============================================================*/
create table t_facility_status
(
   id                   integer PRIMARY KEY autoincrement,
   status               varchar(256) not null,
   status_time          datetime,
   create_time          datetime
);

/*==============================================================*/
/* Table: t_guiding                                             */
/*==============================================================*/
create table t_guiding
(
   id                   integer PRIMARY KEY autoincrement,
   filename             varbinary(128),
   guiding_file_path    varchar(256) not null,
   guiding_no           varchar(256),
   create_time          datetime
);

/*==============================================================*/
/* Table: t_level0_data                                         */
/*==============================================================*/
create table t_level0_data
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
273
274
275
   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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
   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
);

/*==============================================================*/
/* Table: t_level0_header                                       */
/*==============================================================*/
create table t_level0_header
(
   id                   int(20) not null,
   obs_time             datetime,
   exp_time             float,
   ra                   float,
   "dec"                float,
   create_time          datetime,
   primary key (id)
);

/*==============================================================*/
/* Table: t_level0_prc                                          */
/*==============================================================*/
create table t_level0_prc
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
309
   level0_id            varchar(20) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
310
311
   pipeline_id          varchar(64) not null,
   prc_module           varchar(32) not null,
Wei Shoulin's avatar
Wei Shoulin committed
312
   params_file_path     varchar(256),
Wei Shoulin's avatar
c3    
Wei Shoulin committed
313
314
   prc_status           int(2),
   prc_time             datetime,
Wei Shoulin's avatar
Wei Shoulin committed
315
   result_file_path            varchar(256)
Wei Shoulin's avatar
c3    
Wei Shoulin committed
316
);
Wei Shoulin's avatar
Wei Shoulin committed
317
318
319
320
321
322
323
324
325
326
327
328
329
330
/*==============================================================*/
/* Table: t_level1_prc                                          */
/*==============================================================*/
create table t_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
c3    
Wei Shoulin committed
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
/*==============================================================*/
/* Table: t_module_status                                       */
/*==============================================================*/
create table t_module_status
(
   id                   integer PRIMARY KEY autoincrement,
   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,
Wei Shoulin's avatar
Wei Shoulin committed
349
   obs_id               varchar(10),
Wei Shoulin's avatar
c3    
Wei Shoulin committed
350
351
352
353
354
355
356
357
358
359
360
361
362
363
   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,
   prc_status           tinyint(1),
   prc_time             datetime,
   create_time          datetime,
   import_status        tinyint(1)
);