db.sql 9.48 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
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,
Wei Shoulin's avatar
Wei Shoulin committed
39
   level0_id            varchar(20) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
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
   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
create table msc_level1_data
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
79
   level0_id            varchar(20) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
80
81
82
83
84
85
86
87
88
89
90
91
92
93
   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
create table t_cal2level0
(
   merge_id             int(20) not null,
Wei Shoulin's avatar
Wei Shoulin committed
116
   level0_id            varchar(20) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
117
   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
create table t_cal_merge
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
140
141
   cal_id               varchar(20) not null,
   detector_no          varchar(10) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
142
143
144
145
146
147
148
149
150
151
   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
152
153
154
);

/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
155
/* Table: t_detector                                            */
Wei Shoulin's avatar
Wei Shoulin committed
156
/*==============================================================*/
Wei Shoulin's avatar
c3    
Wei Shoulin committed
157
158
create table t_detector
(
Wei Shoulin's avatar
Wei Shoulin committed
159
   no                   varchar(10) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
160
161
162
163
164
165
   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
166
);
Wei Shoulin's avatar
c3    
Wei Shoulin committed
167
168
169
170
171
172
173

/*==============================================================*/
/* Table: t_detector_status                                     */
/*==============================================================*/
create table t_detector_status
(
   id                   integer PRIMARY KEY autoincrement,
Wei Shoulin's avatar
Wei Shoulin committed
174
   detector_no          varchar(10) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
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
   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
209
210
211
   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
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
   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
245
   level0_id            varchar(20) not null,
Wei Shoulin's avatar
c3    
Wei Shoulin committed
246
247
   pipeline_id          varchar(64) not null,
   prc_module           varchar(32) not null,
Wei Shoulin's avatar
Wei Shoulin committed
248
   params_file_path     varchar(256),
Wei Shoulin's avatar
c3    
Wei Shoulin committed
249
250
   prc_status           int(2),
   prc_time             datetime,
Wei Shoulin's avatar
Wei Shoulin committed
251
   result_file_path            varchar(256)
Wei Shoulin's avatar
c3    
Wei Shoulin committed
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
);

/*==============================================================*/
/* 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
272
   obs_id               varchar(10),
Wei Shoulin's avatar
c3    
Wei Shoulin committed
273
274
275
276
277
278
279
280
281
282
283
284
285
286
   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)
);