프로젝트

일반

사용자정보

통계
| 개정판:

hytos / HYTOS / HYTOS / Scripts / CreateTables.sql @ 08184d28

이력 | 보기 | 이력해설 | 다운로드 (13.3 KB)

1
CREATE TABLE IF NOT EXISTS Components (
2
    UID          TEXT NOT NULL,
3
    Symbols_UID  TEXT NOT NULL,
4
    Name         TEXT,
5
    X            REAL,
6
    Y            REAL,
7
    Rotation     REAL,
8
    Scale        REAL DEFAULT (1),
9
    CONSTRAINT PK_Components PRIMARY KEY (
10
        UID
11
    ),    
12
    CONSTRAINT FK_Symbols_UID FOREIGN KEY (
13
        Symbols_UID
14
    )
15
    REFERENCES Symbols (UID) 
16
);
17

    
18
CREATE TABLE IF NOT EXISTS Configuration (
19
    Section TEXT NOT NULL,
20
    [Key]   TEXT NOT NULL,
21
    Value   TEXT NOT NULL,    
22
    CONSTRAINT UQ_Configuration UNIQUE (
23
        Section,
24
        [Key]
25
    )
26
);
27

    
28
CREATE TABLE IF NOT EXISTS DisplayNames (
29
    UID          TEXT NOT NULL,
30
    TABLE_NAME   TEXT NOT NULL,
31
    COLUMN_NAME  TEXT NOT NULL,
32
    DISPLAY_NAME TEXT,
33
    [Order]      INTEGER NOT NULL,
34
    CONSTRAINT PK_DisplayNames PRIMARY KEY (
35
        UID
36
    ),
37
    CONSTRAINT UQ_DisplayNames UNIQUE (
38
        TABLE_NAME,
39
        COLUMN_NAME,
40
        [Order]
41
    )
42
);
43

    
44

    
45
CREATE TABLE IF NOT EXISTS Fittings_2K (
46
    UID                                    TEXT    NOT NULL,
47
    Components_UID                         TEXT    NOT NULL,
48
    [90_Elbow_Standard_Screw]              INTEGER,
49
    [90_Elbow_Standard_Flange_Weld]        INTEGER,
50
    [90_Elbow_Long_Radius_All]             INTEGER,
51
    [90_Elbow_1_Weld]                      INTEGER,
52
    [90_Elbow_2_Weld]                      INTEGER,
53
    [90_Elbow_3_Weld]                      INTEGER,
54
    [90_Elbow_4_Weld]                      INTEGER,
55
    [90_Elbow_5_Weld]                      INTEGER,
56
    [45_Elbow_Standard_All]                INTEGER,
57
    [45_Elbow_Long_Radius_All]             INTEGER,
58
    [45_Elbow_1_Weld]                      INTEGER,
59
    [45_Elbow_2_Weld]                      INTEGER,
60
    [180_Elbow_Standard_Screw]             INTEGER,
61
    [180_Elbow_Standard_Flange_Weld]       INTEGER,
62
    [180_Elbow_Long_Radius_All]            INTEGER,
63
    Tee_Elbow_Standard_Screw               INTEGER,
64
    Tee_Elbow_Long_Radius_Screw            INTEGER,
65
    Tee_Elbow_Standard_Flange_Weld         INTEGER,
66
    Tee_Elbow_Stub_In_Branch               INTEGER,
67
    Tee_Through_Screw                      INTEGER,
68
    Tee_Through_Flange_Weld                INTEGER,
69
    Tee_Through_Stub_In_Branch             INTEGER,
70
    Gate_Ball_Plug_Valve_Full              INTEGER,
71
    [Gate_Ball_Plug_Valve_Reduce_Trim_0.9] INTEGER,
72
    [Gate_Ball_Plug_Valve_Reduce_Trim_0.8] INTEGER,
73
    Globe_Valve_Standard                   INTEGER,
74
    Globe_Valve_Angle_YType                INTEGER,
75
    Diaphragm_Dam_Valve                    INTEGER,
76
    Butterfly_Valve                        INTEGER,
77
    Check_Valve_Lift                       INTEGER,
78
    Check_Valve_Swing                      INTEGER,
79
    Check_Valve_Tilting                    INTEGER,
80
    Pipe_Entrance_Normal                   INTEGER,
81
    Pipe_Entrance_Borda                    INTEGER,
82
    Pipe_Exit                              INTEGER,
83
    Resistance_Coefficiency                REAL,
84
    Calculated_Fitting                     REAL,
85
    CONSTRAINT PK_Fittings_2K PRIMARY KEY (
86
        UID
87
    ),
88
    CONSTRAINT FK_Components_UID FOREIGN KEY (
89
        Components_UID
90
    )
91
    REFERENCES Components (UID) ON DELETE CASCADE
92
);
93

    
94
CREATE TABLE IF NOT EXISTS Fittings_CraneK (
95
    UID                              TEXT    NOT NULL,
96
    Components_UID                   TEXT    NOT NULL,
97
    [90_Elbow_Standard_Screw]        INTEGER,
98
    [90_Elbow_Long_Radius_1]         INTEGER,
99
    [90_Elbow_Long_Radius_1.5]       INTEGER,
100
    [90_Elbow_Long_Radius_2]         INTEGER,
101
    [90_Elbow_Long_Radius_3]         INTEGER,
102
    [90_Elbow_Long_Radius_4]         INTEGER,
103
    [90_Elbow_Long_Radius_6]         INTEGER,
104
    [90_Elbow_Long_Radius_8]         INTEGER,
105
    [90_Elbow_Long_Radius_10]        INTEGER,
106
    [90_Elbow_Long_Radius_12]        INTEGER,
107
    [90_Elbow_Long_Radius_14]        INTEGER,
108
    [90_Elbow_Long_Radius_16]        INTEGER,
109
    [90_Elbow_Long_Radius_20]        INTEGER,
110
    [90_Elbow_1_Weld]                INTEGER,
111
    [90_Elbow_2_Weld]                INTEGER,
112
    [90_Elbow_3_Weld]                INTEGER,
113
    [90_Elbow_6_Weld]                INTEGER,
114
    [45_Elbow_Standard_Screw]        INTEGER,
115
    [45_Elbow_1_Weld]                INTEGER,
116
    [45_Elbow_3_Weld]                INTEGER,
117
    [180_Elbow_Standard_Screw]       INTEGER,
118
    [180_Elbow_Long_Radius_1]        INTEGER,
119
    [180_Elbow_Long_Radius_1.5]      INTEGER,
120
    [180_Elbow_Long_Radius_2]        INTEGER,
121
    [180_Elbow_Long_Radius_3]        INTEGER,
122
    [180_Elbow_Long_Radius_4]        INTEGER,
123
    [180_Elbow_Long_Radius_6]        INTEGER,
124
    [180_Elbow_Long_Radius_8]        INTEGER,
125
    [180_Elbow_Long_Radius_10]       INTEGER,
126
    [180_Elbow_Long_Radius_12]       INTEGER,
127
    [180_Elbow_Long_Radius_14]       INTEGER,
128
    [180_Elbow_Long_Radius_16]       INTEGER,
129
    [180_Elbow_Long_Radius_20]       INTEGER,
130
    [180_Elbow_2_Weld]               INTEGER,
131
    [180_Elbow_3_Weld]               INTEGER,
132
    [180_Elbow_4_Weld]               INTEGER,
133
    [180_Elbow_6_Weld]               INTEGER,
134
    [180_Elbow_12_Weld]              INTEGER,
135
    Tee_Through                      INTEGER,
136
    Tee_Elbow                        INTEGER,
137
    Expander                         INTEGER,
138
    Reducer                          INTEGER,
139
    Globe_Valve_Standard             INTEGER,
140
    Globe_Valve_45_Angle             INTEGER,
141
    Globe_Valve_90_Angle             INTEGER,
142
    Plug_Valve_1_Way                 INTEGER,
143
    Plug_Valve_3_Way_Through         INTEGER,
144
    Plug_Valve_3_Way_Elbow           INTEGER,
145
    Foot_Valve_Poppet_Disc           INTEGER,
146
    Foot_Valve_Hinged_Disc           INTEGER,
147
    Gate_Valve                       INTEGER,
148
    Ball_Valve                       INTEGER,
149
    Butterfly_Valve                  INTEGER,
150
    Pipe_Enterance_Projecting        INTEGER,
151
    [Pipe_Enterance_Flush_0.00]      INTEGER,
152
    [Pipe_Enterance_Flush_0.02]      INTEGER,
153
    [Pipe_Enterance_Flush_0.04]      INTEGER,
154
    [Pipe_Enterance_Flush_0.06]      INTEGER,
155
    [Pipe_Enterance_Flush_0.10]      INTEGER,
156
    [Pipe_Enterance_Flush_0.15]      INTEGER,
157
    Pipe_Exit_Projecting             INTEGER,
158
    Pipe_Exit_Sharp_Edged            INTEGER,
159
    Pipe_Exit_Rounded                INTEGER,
160
    Check_Valve_Swing_Vertical       INTEGER,
161
    Check_Valve_Swing_Angled         INTEGER,
162
    Check_Valve_Lift_Straight        INTEGER,
163
    Check_Valve_Lift_Angled          INTEGER,
164
    [Check_Valve_Tilting_Alpha_5]    INTEGER,
165
    [Check_Valve_Tilting_Alpha_15]   INTEGER,
166
    Check_Valve_Globe_Stop           INTEGER,
167
    Check_Valve_Globe_Stop_45_Angle  INTEGER,
168
    Check_Valve_Globe_Stop_Inline    INTEGER,
169
    Check_Valve_Angled_Stop          INTEGER,
170
    Check_Valve_Angled_Stop_45_Angle INTEGER,
171
    Check_Valve_Angled_Stop_Inline   INTEGER,
172
    User_Input                       INTEGER,
173
    Resistance_Coefficiency          REAL,
174
    Calculated_Fitting               REAL,
175
    CONSTRAINT PK_Fittings_CraneK PRIMARY KEY (
176
        UID
177
    ),
178
    CONSTRAINT FK_Components_UID FOREIGN KEY (
179
        Components_UID
180
    )
181
    REFERENCES Components (UID) ON DELETE CASCADE
182
);
183

    
184
CREATE TABLE IF NOT EXISTS Fittings_EquivalentLength (
185
    UID                  TEXT    NOT NULL,
186
    Components_UID       TEXT    NOT NULL,
187
    Gate_Ball_Plug_Valve INTEGER,
188
    Globe_Valve          INTEGER,
189
    Butterfly_Valve      INTEGER,
190
    Check_Valve          INTEGER,
191
    [90_Elbow]           INTEGER,
192
    [45_Elbo]            INTEGER,
193
    Tee_Branch           INTEGER,
194
    Tee_Through          INTEGER,
195
    Milter               INTEGER,
196
    Milter_Degree        INTEGER,
197
    Nozzle_In_YN         BOOLEAN,
198
    Nozzle_Out_YN        BOOLEAN,
199
    Calculated_Fitting   REAL,
200
    CONSTRAINT PK_Fittings_EquivalentLength PRIMARY KEY (
201
        UID
202
    ),
203
    CONSTRAINT FK_Components_UID FOREIGN KEY (
204
        Components_UID
205
    )
206
    REFERENCES Components (UID) ON DELETE CASCADE
207
);
208

    
209
CREATE TABLE IF NOT EXISTS HMB (
210
        UID                      TEXT    NOT NULL,
211
    Components_UID           TEXT    NOT NULL,
212
    Stream_No                INTEGER NOT NULL,
213
    Phase_Type               TEXT,
214
    Flowrate_Mass            REAL,
215
    Flowrate_Volume          REAL,
216
    Density                  REAL,
217
    Viscosity                REAL,
218
    Temperature              REAL,
219
    Molecular_Weight         REAL,
220
    Specific_Heat_Ratio      REAL,
221
    Compress_Factor          REAL,
222
    Nominal_Pipe_Size        REAL,
223
    Inside_Pipe_Size         REAL,
224
    Schedule_No              TEXT,
225
    Straight_Length          REAL,
226
    Equivalent_Length        REAL,
227
    Roughness                REAL,
228
    Limitation_Velocity      REAL,
229
    Limitation_Pressure_Drop REAL,
230
    Velocity                 REAL,
231
    Reynolds                 REAL,
232
    Friction_Factor          REAL,
233
    Pressure_Drop            REAL,
234
    Pressure_Drop_Friction   REAL,
235
    Pressure_Drop_Static     REAL,
236
    Pressure_Pipe_End_Point  REAL,
237
    Power                    REAL,
238
    CONSTRAINT PK_HMB PRIMARY KEY (
239
        UID
240
    ),
241
    CONSTRAINT FK_Components_UID FOREIGN KEY (
242
        Components_UID
243
    )
244
    REFERENCES Components (UID) ON DELETE CASCADE,
245
    CONSTRAINT UQ_HMB UNIQUE (
246
        Components_UID,
247
        Stream_No
248
    )
249
);
250

    
251
CREATE TABLE IF NOT EXISTS NominalDiameter (
252
    UID                TEXT NOT NULL,
253
    Milimeter          REAL NOT NULL,
254
    Inch               REAL NOT NULL,
255
    Friction_Factor    REAL NOT NULL,
256
    CONSTRAINT PK_NominalDiameter PRIMARY KEY (
257
        UID
258
    )
259
);
260

    
261
CREATE TABLE IF NOT EXISTS Nozzles (
262
    Points_UID                   TEXT NOT NULL,
263
    Pressure                     REAL,
264
    Pressure_Drop                REAL,
265
    Elevation                    REAL,
266
    Over_Design_CV               REAL,
267
    CV_Type                      TEXT,
268
    Total_Discharge_Loss         REAL,
269
    Total_Suction_Loass          REAL,
270
    Total_Loss                   REAL,
271
    Discharge_Device_Loss        REAL,
272
    Suction_Device_Loss          REAL,
273
    Total_Device_Loss            REAL,
274
    Discharge_Line_Friction_Loss REAL,
275
    Suction_Line_Friction_Loss   REAL,
276
    Line_Total_Frictoin_Loss     REAL,
277
    CONSTRAINT PK_Nozzles PRIMARY KEY (
278
        Points_UID
279
    ),
280
    CONSTRAINT FK_Points_UID FOREIGN KEY (
281
        Points_UID
282
    )
283
    REFERENCES Points (UID) ON DELETE CASCADE
284
);
285

    
286
CREATE TABLE IF NOT EXISTS Points (
287
    UID            TEXT    NOT NULL,
288
    Components_UID TEXT    NOT NULL,
289
    [Index]        INTEGER NOT NULL,
290
    X              REAL    NOT NULL,
291
    Y              REAL    NOT NULL,
292
    ConnectedItem_UID TEXT,
293
    CONSTRAINT PK_Points PRIMARY KEY (
294
        UID
295
    ),
296
    CONSTRAINT FK_Components_UID FOREIGN KEY (
297
        Components_UID
298
    )
299
    REFERENCES Components (UID) ON DELETE CASCADE
300
);
301

    
302
CREATE TABLE IF NOT EXISTS Roughness (
303
    UID       TEXT NOT NULL,
304
    Material  TEXT NOT NULL,
305
    Meter     REAL NOT NULL,
306
    Inch      REAL NOT NULL,
307
    Feet      REAL NOT NULL,
308
    Milimeter REAL NOT NULL,
309
    CONSTRAINT PK_Roughness PRIMARY KEY (
310
        UID
311
    ),
312
    CONSTRAINT UQ_Roughness UNIQUE (
313
        Material
314
    )
315
);
316

    
317
CREATE TABLE IF NOT EXISTS Symbols (
318
    UID             TEXT NOT NULL,
319
    Name            TEXT NOT NULL,
320
    Display_Name    TEXT NOT NULL,
321
    SymbolType_UID  TEXT NOT NULL,
322
    OriginalPoint   TEXT NOT NULL,
323
    ConnectionPoint TEXT,
324
    CONSTRAINT PK_Symbols PRIMARY KEY (
325
        UID
326
    ),
327
    CONSTRAINT FK_SymbolType_UID FOREIGN KEY (
328
        SymbolType_UID
329
    )
330
    REFERENCES SymbolType (UID) 
331
);
332

    
333
CREATE TABLE IF NOT EXISTS SymbolType(
334
    UID      TEXT NOT NULL,
335
    Category TEXT NOT NULL,
336
    Type     TEXT NOT NULL,
337
    CONSTRAINT PK_SymbolType PRIMARY KEY (
338
        UID
339
    ),
340
    CONSTRAINT UQ_SymbolType UNIQUE (
341
        Category,
342
        Type
343
    )
344
);
345

    
346
CREATE TABLE IF NOT EXISTS Units (
347
    UID         TEXT NOT NULL,
348
    [Key]       TEXT NOT NULL,
349
    Value       TEXT NOT NULL,
350
    CONSTRAINT PK_Units PRIMARY KEY (
351
        UID
352
    ),
353
    CONSTRAINT UQ_Units UNIQUE (
354
        [Key],
355
        Value
356
    )
357
);
358

    
359
CREATE TABLE IF NOT EXISTS HMBUnits (
360
    UID                 TEXT NOT NULL,
361
    COLUMN_NAME         TEXT NOT NULL,
362
    Units_Expression    TEXT,
363
    CONSTRAINT PK_HMBUnits PRIMARY KEY (
364
        UID
365
    ),
366
    CONSTRAINT UQ_HMBUnits UNIQUE (
367
        COLUMN_NAME
368
    )
369
);
370

    
371

    
372
CREATE TABLE IF NOT EXISTS Schedule (
373
    UID                 TEXT NOT NULL,
374
    [No]                TEXT NOT NULL,
375
    CONSTRAINT PK_Schedule PRIMARY KEY (
376
        UID
377
    ),
378
    CONSTRAINT UQ_Schedule UNIQUE (
379
        [No]
380
    )
381
);
382

    
383

    
384
CREATE TABLE IF NOT EXISTS InsideDiameter (
385
    UID                 TEXT NOT NULL,
386
    NominalDiameter_UID TEXT NOT NULL,
387
    Schedule_UID        TEXT NOT NULL,
388
    Milimeter           REAL,
389
    Inch                REAL,
390
    CONSTRAINT PK_InsideDiameter PRIMARY KEY (
391
        UID
392
    ),
393
    CONSTRAINT FK_NominalDiameter_UID FOREIGN KEY (
394
        NominalDiameter_UID
395
    )
396
    REFERENCES NominalDiameter (UID),
397
    CONSTRAINT FK_Schedule_UID FOREIGN KEY (
398
        Schedule_UID
399
    )
400
    REFERENCES Schedule (UID),
401
    CONSTRAINT UQ_InsideDiameter UNIQUE (
402
        NominalDiameter_UID,
403
        Schedule_UID
404
    )
405
);
406

    
407
CREATE TABLE IF NOT EXISTS ResistanceCoefficient (
408
    UID      TEXT NOT NULL,
409
    Method   TEXT NOT NULL,
410
    Category TEXT NOT NULL,
411
    Type     TEXT NOT NULL,
412
    Name     TEXT NOT NULL,
413
    K        REAL NOT NULL,
414
    CONSTRAINT PK_ResistanceCoefficient PRIMARY KEY (
415
        UID
416
    ),
417
    CONSTRAINT UQ_ResistanceCoefficient UNIQUE (
418
        Method,
419
        Category,
420
        Type,
421
        Name
422
    )
423
);
클립보드 이미지 추가 (최대 크기: 500 MB)