db.sql 9.33 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
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
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;

/*==============================================================*/
/* Table: ifs_level1_data                                       */
/*==============================================================*/
create table ifs_level1_data
(
   id                   integer PRIMARY KEY autoincrement,
   raw_id               int(20) not null,
   data_type            varchar(64) not null,
   cor_sci_id           int(20),
   prc_params           varchar(1024),
   flat_id              int(20),
   dark_id              int(20),
   bias_id              int(20),
   lamp_id              int(20),
   arc_id               int(20),
   sky_id               int(20),
   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: 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
73
/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
74
/* Table: msc_level1_data                                       */
Wei Shoulin's avatar
Wei Shoulin committed
75
/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
create table msc_level1_data
(
   id                   integer PRIMARY KEY autoincrement,
   raw_id               int(20) not null,
   data_type            varchar(64) not null,
   cor_sci_id           int(20),
   prc_params           varchar(1024),
   flat_id              int(20),
   dark_id              int(20),
   bias_id              int(20),
   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
94
95
96
);

/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
97
/* Table: msc_level1_header                                     */
Wei Shoulin's avatar
Wei Shoulin committed
98
/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
99
100
101
102
103
104
105
106
107
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
108
109
110
);

/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
111
/* Table: t_cal2level0                                          */
Wei Shoulin's avatar
Wei Shoulin committed
112
/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
113
114
115
116
117
create table t_cal2level0
(
   merge_id             int(20) not null,
   level0_id            int(20) not null,
   primary key (merge_id, level0_id)
Wei Shoulin's avatar
Wei Shoulin committed
118
119
120
);

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

/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
135
/* Table: t_cal_merge                                           */
Wei Shoulin's avatar
Wei Shoulin committed
136
/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
137
138
139
140
141
142
143
144
145
146
147
148
149
150
create table t_cal_merge
(
   id                   integer PRIMARY KEY autoincrement,
   detector_no          varchar(64) 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
Wei Shoulin's avatar
Wei Shoulin committed
151
152
153
);

/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
154
/* Table: t_detector                                            */
Wei Shoulin's avatar
Wei Shoulin committed
155
/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
156
157
158
159
160
161
162
163
164
create table t_detector
(
   no                   varchar(64) 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
165
);
Wei Shoulin's avatar
c3    
Wei Shoulin committed
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
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
273
274
275
276
277
278
279
280
281
282
283

/*==============================================================*/
/* Table: t_detector_status                                     */
/*==============================================================*/
create table t_detector_status
(
   id                   integer PRIMARY KEY autoincrement,
   detector_no          varchar(64) not null,
   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,
   obs_id               int(20) not null,
   detector_no          varchar(64) 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
);

/*==============================================================*/
/* 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,
   level0_id            int(20) not null,
   pipeline_id          varchar(64) not null,
   prc_module           varchar(32) not null,
   params_id            varchar(256),
   prc_status           int(2),
   prc_time             datetime,
   file_path            varchar(256)
);

/*==============================================================*/
/* 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,
   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)
);