프로젝트

일반

사용자정보

통계
| 개정판:

hytos / HYTOS / HYTOS / Scripts / CreateTables.sql @ 417432b0

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

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

    
23
CREATE TABLE IF NOT EXISTS Configuration (
24
    UID     TEXT NOT NULL,
25
    Section TEXT NOT NULL,
26
    [Key]   TEXT NOT NULL,
27
    Value   TEXT NOT NULL,
28
    CONSTRAINT PK_Configuration PRIMARY KEY (
29
        UID
30
    ),
31
    CONSTRAINT UQ_Configuration UNIQUE (
32
        Section,
33
        [Key]
34
    )
35
);
36

    
37
CREATE TABLE IF NOT EXISTS DisplayNames (
38
    UID          TEXT NOT NULL,
39
    TABLE_NAME   TEXT NOT NULL,
40
    COLUMN_NAME  TEXT NOT NULL,
41
    DISPLAY_NAME TEXT,
42
    [Order]      INTEGER NOT NULL,
43
    CONSTRAINT PK_DisplayNames PRIMARY KEY (
44
        UID
45
    ),
46
    CONSTRAINT UQ_DisplayNames UNIQUE (
47
        TABLE_NAME,
48
        COLUMN_NAME,
49
        [Order]
50
    )
51
);
52

    
53
CREATE TABLE IF NOT EXISTS Drawings (
54
    UID      TEXT NOT NULL,
55
    NAME     TEXT NOT NULL,
56
    DATETIME TEXT NOT NULL,
57
    CONSTRAINT PK_Drawings PRIMARY KEY (
58
        UID
59
    ),
60
    CONSTRAINT UQ_Drawings UNIQUE (
61
        NAME
62
    )
63
);
64

    
65
CREATE TABLE IF NOT EXISTS DrawingsUnits (
66
    UID          TEXT NOT NULL,
67
    Drawings_UID TEXT NOT NULL,
68
    Units        TEXT NOT NULL,
69
    Units_UID    TEXT NOT NULL,
70
    CONSTRAINT PK_DrawingsUnits PRIMARY KEY (
71
        UID
72
    ),
73
    CONSTRAINT FK_Drawings_UID FOREIGN KEY (
74
        Drawings_UID
75
    )
76
    REFERENCES Drawings (UID),
77
    CONSTRAINT FK_Units_UID FOREIGN KEY (
78
        Units_UID
79
    )
80
    REFERENCES Units (UID) 
81
);
82

    
83

    
84
CREATE TABLE IF NOT EXISTS Fittings_2K (
85
    UID                                    TEXT    NOT NULL,
86
    Components_UID                         TEXT    NOT NULL,
87
    [90_Elbow_Standard_Screw]              INTEGER,
88
    [90_Elbow_Standard_Flange_Weld]        INTEGER,
89
    [90_Elbow_Long_Radius_All]             INTEGER,
90
    [90_Elbow_1_Weld]                      INTEGER,
91
    [90_Elbow_2_Weld]                      INTEGER,
92
    [90_Elbow_3_Weld]                      INTEGER,
93
    [90_Elbow_4_Weld]                      INTEGER,
94
    [90_Elbow_5_Weld]                      INTEGER,
95
    [45_Elbow_Standard_All]                INTEGER,
96
    [45_Elbow_Long_Radius_All]             INTEGER,
97
    [45_Elbow_1_Weld]                      INTEGER,
98
    [45_Elbow_2_Weld]                      INTEGER,
99
    [180_Elbow_Standard_Screw]             INTEGER,
100
    [180_Elbow_Standard_Flange_Weld]       INTEGER,
101
    [180_Elbow_Long_Radius_All]            INTEGER,
102
    Tee_Elbow_Standard_Screw               INTEGER,
103
    Tee_Elbow_Long_Radius_Screw            INTEGER,
104
    Tee_Elbow_Standard_Flange_Weld         INTEGER,
105
    Tee_Elbow_Stub_In_Branch               INTEGER,
106
    Tee_Through_Screw                      INTEGER,
107
    Tee_Through_Flange_Weld                INTEGER,
108
    Tee_Through_Stub_In_Branch             INTEGER,
109
    Gate_Ball_Plug_Valve_Full              INTEGER,
110
    [Gate_Ball_Plug_Valve_Reduce_Trim_0.9] INTEGER,
111
    [Gate_Ball_Plug_Valve_Reduce_Trim_0.8] INTEGER,
112
    Globe_Valve_Standard                   INTEGER,
113
    Globe_Valve_Angle_YType                INTEGER,
114
    Diaphragm_Dam_Valve                    INTEGER,
115
    Butterfly_Valve                        INTEGER,
116
    Check_Valve_Lift                       INTEGER,
117
    Check_Valve_Swing                      INTEGER,
118
    Check_Valve_Tilting                    INTEGER,
119
    Pipe_Entrance_Normal                   INTEGER,
120
    Pipe_Entrance_Borda                    INTEGER,
121
    Pipe_Exit                              INTEGER,
122
    Resistance_Coefficiency                REAL,
123
    Calculated_Fitting                     REAL,
124
    CONSTRAINT PK_Fittings_2K PRIMARY KEY (
125
        UID
126
    ),
127
    CONSTRAINT FK_Components_UID FOREIGN KEY (
128
        Components_UID
129
    )
130
    REFERENCES Components (UID) 
131
);
132

    
133
CREATE TABLE IF NOT EXISTS Fittings_CraneK (
134
    UID                              TEXT    NOT NULL,
135
    Components_UID                   TEXT    NOT NULL,
136
    [90_Elbow_Standard_Screw]        INTEGER,
137
    [90_Elbow_Long_Radius_1]         INTEGER,
138
    [90_Elbow_Long_Radius_1.5]       INTEGER,
139
    [90_Elbow_Long_Radius_2]         INTEGER,
140
    [90_Elbow_Long_Radius_3]         INTEGER,
141
    [90_Elbow_Long_Radius_4]         INTEGER,
142
    [90_Elbow_Long_Radius_6]         INTEGER,
143
    [90_Elbow_Long_Radius_8]         INTEGER,
144
    [90_Elbow_Long_Radius_10]        INTEGER,
145
    [90_Elbow_Long_Radius_12]        INTEGER,
146
    [90_Elbow_Long_Radius_14]        INTEGER,
147
    [90_Elbow_Long_Radius_16]        INTEGER,
148
    [90_Elbow_Long_Radius_20]        INTEGER,
149
    [90_Elbow_1_Weld]                INTEGER,
150
    [90_Elbow_2_Weld]                INTEGER,
151
    [90_Elbow_3_Weld]                INTEGER,
152
    [90_Elbow_6_Weld]                INTEGER,
153
    [45_Elbow_Standard_Screw]        INTEGER,
154
    [45_Elbow_1_Weld]                INTEGER,
155
    [45_Elbow_3_Weld]                INTEGER,
156
    [180_Elbow_Standard_Screw]       INTEGER,
157
    [180_Elbow_Long_Radius_1]        INTEGER,
158
    [180_Elbow_Long_Radius_1.5]      INTEGER,
159
    [180_Elbow_Long_Radius_2]        INTEGER,
160
    [180_Elbow_Long_Radius_3]        INTEGER,
161
    [180_Elbow_Long_Radius_4]        INTEGER,
162
    [180_Elbow_Long_Radius_6]        INTEGER,
163
    [180_Elbow_Long_Radius_8]        INTEGER,
164
    [180_Elbow_Long_Radius_10]       INTEGER,
165
    [180_Elbow_Long_Radius_12]       INTEGER,
166
    [180_Elbow_Long_Radius_14]       INTEGER,
167
    [180_Elbow_Long_Radius_16]       INTEGER,
168
    [180_Elbow_Long_Radius_20]       INTEGER,
169
    [180_Elbow_2_Weld]               INTEGER,
170
    [180_Elbow_3_Weld]               INTEGER,
171
    [180_Elbow_4_Weld]               INTEGER,
172
    [180_Elbow_6_Weld]               INTEGER,
173
    [180_Elbow_12_Weld]              INTEGER,
174
    Tee_Through                      INTEGER,
175
    Tee_Elbow                        INTEGER,
176
    Expander                         INTEGER,
177
    Reducer                          INTEGER,
178
    Globe_Valve_Standard             INTEGER,
179
    Globe_Valve_45_Angle             INTEGER,
180
    Globe_Valve_90_Angle             INTEGER,
181
    Plug_Valve_1_Way                 INTEGER,
182
    Plug_Valve_3_Way_Through         INTEGER,
183
    Plug_Valve_3_Way_Elbow           INTEGER,
184
    Foot_Valve_Poppet_Disc           INTEGER,
185
    Foot_Valve_Hinged_Disc           INTEGER,
186
    Gate_Valve                       INTEGER,
187
    Ball_Valve                       INTEGER,
188
    Butterfly_Valve                  INTEGER,
189
    Pipe_Enterance_Projecting        INTEGER,
190
    [Pipe_Enterance_Flush_0.00]      INTEGER,
191
    [Pipe_Enterance_Flush_0.02]      INTEGER,
192
    [Pipe_Enterance_Flush_0.04]      INTEGER,
193
    [Pipe_Enterance_Flush_0.06]      INTEGER,
194
    [Pipe_Enterance_Flush_0.10]      INTEGER,
195
    [Pipe_Enterance_Flush_0.15]      INTEGER,
196
    Pipe_Exit_Projecting             INTEGER,
197
    Pipe_Exit_Sharp_Edged            INTEGER,
198
    Pipe_Exit_Rounded                INTEGER,
199
    Check_Valve_Swing_Vertical       INTEGER,
200
    Check_Valve_Swing_Angled         INTEGER,
201
    Check_Valve_Lift_Straight        INTEGER,
202
    Check_Valve_Lift_Angled          INTEGER,
203
    [Check_Valve_Tilting_Alpha_5]    INTEGER,
204
    [Check_Valve_Tilting_Alpha_15]   INTEGER,
205
    Check_Valve_Globe_Stop           INTEGER,
206
    Check_Valve_Globe_Stop_45_Angle  INTEGER,
207
    Check_Valve_Globe_Stop_Inline    INTEGER,
208
    Check_Valve_Angled_Stop          INTEGER,
209
    Check_Valve_Angled_Stop_45_Angle INTEGER,
210
    Check_Valve_Angled_Stop_Inline   INTEGER,
211
    User_Input                       INTEGER,
212
    Resistance_Coefficiency          REAL,
213
    Calculated_Fitting               REAL,
214
    CONSTRAINT PK_Fittings_CraneK PRIMARY KEY (
215
        UID
216
    ),
217
    CONSTRAINT FK_Components_UID FOREIGN KEY (
218
        Components_UID
219
    )
220
    REFERENCES Components (UID) 
221
);
222

    
223
CREATE TABLE IF NOT EXISTS Fittings_EquivalentLength (
224
    UID                  TEXT    NOT NULL,
225
    Components_UID       TEXT    NOT NULL,
226
    Gate_Ball_Plug_Valve INTEGER,
227
    Globe_Valve          INTEGER,
228
    Butterfly_Valve      INTEGER,
229
    Check_Valve          INTEGER,
230
    [90_Elbow]           INTEGER,
231
    [45_Elbo]            INTEGER,
232
    Tee_Branch           INTEGER,
233
    Tee_Through          INTEGER,
234
    Milter               INTEGER,
235
    Milter_Degree        INTEGER,
236
    Nozzle_In_YN         BOOLEAN,
237
    Nozzle_Out_YN        BOOLEAN,
238
    Calculated_Fitting   REAL,
239
    CONSTRAINT PK_Fittings_EquivalentLength PRIMARY KEY (
240
        UID
241
    ),
242
    CONSTRAINT FK_Components_UID FOREIGN KEY (
243
        Components_UID
244
    )
245
    REFERENCES Components (UID) 
246
);
247

    
248
CREATE TABLE IF NOT EXISTS HMB (
249
        UID                      TEXT    NOT NULL,
250
    Components_UID           TEXT    NOT NULL,
251
    Stream_No                INTEGER NOT NULL,
252
    Phase_Type               TEXT,
253
    Flowrate_Mass            REAL,
254
    Flowrate_Volume          REAL,
255
    Density                  REAL,
256
    Viscosity                REAL,
257
    Temperature              REAL,
258
    Molecular_Weight         REAL,
259
    Specific_Heat_Ratio      REAL,
260
    Compress_Factor          REAL,
261
    Nominal_Pipe_Size        REAL,
262
    Inside_Pipe_Size         REAL,
263
    Schedule_No              TEXT,
264
    Straight_Length          REAL,
265
    Equivalent_Length        REAL,
266
    Roughness                REAL,
267
    Limitation_Velocity      REAL,
268
    Limitation_Pressure_Drop REAL,
269
    Velocity                 REAL,
270
    Reynolds                 REAL,
271
    Friction_Factor          REAL,
272
    Pressure_Drop            REAL,
273
    Pressure_Drop_Friction   REAL,
274
    Pressure_Drop_Static     REAL,
275
    Pressure_Pipe_End_Point  REAL,
276
    Power                    REAL,
277
    CONSTRAINT PK_HMB PRIMARY KEY (
278
        UID
279
    ),
280
    CONSTRAINT FK_Components_UID FOREIGN KEY (
281
        Components_UID
282
    )
283
    REFERENCES Components (UID),
284
    CONSTRAINT UQ_HMB UNIQUE (
285
        Components_UID,
286
        Stream_No
287
    )
288
);
289

    
290
CREATE TABLE IF NOT EXISTS Loops (
291
    UID              TEXT    NOT NULL,
292
    Name             TEXT    NOT NULL,
293
    From_Nozzles_UID TEXT    NOT NULL,
294
    Stream_No        INTEGER NOT NULL,
295
    To_Nozzles_UID   TEXT    NOT NULL,
296
    CONSTRAINT PK_Loops PRIMARY KEY (
297
        UID
298
    ),
299
    CONSTRAINT FK_From_Nozzles_UID FOREIGN KEY (
300
        From_Nozzles_UID
301
    )
302
    REFERENCES Nozzles (UID),
303
    CONSTRAINT FK_Stream_No FOREIGN KEY (
304
        Stream_No
305
    )
306
    REFERENCES HMB (Stream_No),
307
    CONSTRAINT FK_To_Nozzles_UID FOREIGN KEY (
308
        To_Nozzles_UID
309
    )
310
    REFERENCES Nozzles (UID) 
311
);
312

    
313
CREATE TABLE IF NOT EXISTS NominalDiameter (
314
    UID                TEXT NOT NULL,
315
    Milimeter          REAL NOT NULL,
316
    Inch               REAL NOT NULL,
317
    Friction_Factor    REAL NOT NULL,
318
    CONSTRAINT PK_NominalDiameter PRIMARY KEY (
319
        UID
320
    )
321
);
322

    
323
CREATE TABLE IF NOT EXISTS Nozzles (
324
    UID                          TEXT NOT NULL,
325
    Points_UID                   TEXT NOT NULL,
326
    Pressure                     REAL,
327
    Pressure_Drop                REAL,
328
    Elevation                    REAL,
329
    Over_Design_CV               REAL,
330
    CV_Type                      TEXT,
331
    Total_Discharge_Loss         REAL,
332
    Total_Suction_Loass          REAL,
333
    Total_Loss                   REAL,
334
    Discharge_Device_Loss        REAL,
335
    Suction_Device_Loss          REAL,
336
    Total_Device_Loss            REAL,
337
    Discharge_Line_Friction_Loss REAL,
338
    Suction_Line_Friction_Loss   REAL,
339
    Line_Total_Frictoin_Loss     REAL,
340
    CONSTRAINT PK_Nozzles PRIMARY KEY (
341
        UID
342
    ),
343
    CONSTRAINT FK_Points_UID FOREIGN KEY (
344
        Points_UID
345
    )
346
    REFERENCES Points (UID) 
347
);
348

    
349
CREATE TABLE IF NOT EXISTS Points (
350
    UID            TEXT    NOT NULL,
351
    Components_UID TEXT    NOT NULL,
352
    [Index]        INTEGER NOT NULL,
353
    X              REAL    NOT NULL,
354
    Y              REAL    NOT NULL,
355
    ConnectedItem_UID TEXT,
356
    CONSTRAINT PK_Points PRIMARY KEY (
357
        UID
358
    ),
359
    CONSTRAINT FK_Components_UID FOREIGN KEY (
360
        Components_UID
361
    )
362
    REFERENCES Components (UID) 
363
);
364

    
365
CREATE TABLE IF NOT EXISTS Roughness (
366
    UID       TEXT NOT NULL,
367
    Material  TEXT NOT NULL,
368
    Meter     REAL NOT NULL,
369
    Inch      REAL NOT NULL,
370
    Feet      REAL NOT NULL,
371
    Milimeter REAL NOT NULL,
372
    CONSTRAINT PK_Roughness PRIMARY KEY (
373
        UID
374
    ),
375
    CONSTRAINT UQ_Roughness UNIQUE (
376
        Material
377
    )
378
);
379

    
380
CREATE TABLE IF NOT EXISTS Symbols (
381
    UID             TEXT NOT NULL,
382
    Name            TEXT NOT NULL,
383
    SymbolType_UID  TEXT NOT NULL,
384
    OriginalPoint   TEXT NOT NULL,
385
    ConnectionPoint TEXT,
386
    CONSTRAINT PK_Symbols PRIMARY KEY (
387
        UID
388
    ),
389
    CONSTRAINT FK_SymbolType_UID FOREIGN KEY (
390
        SymbolType_UID
391
    )
392
    REFERENCES SymbolType (UID) 
393
);
394

    
395
CREATE TABLE IF NOT EXISTS SymbolType(
396
    UID      TEXT NOT NULL,
397
    Category TEXT NOT NULL,
398
    Type     TEXT NOT NULL,
399
    CONSTRAINT PK_SymbolType PRIMARY KEY (
400
        UID
401
    ),
402
    CONSTRAINT UQ_SymbolType UNIQUE (
403
        Category,
404
        Type
405
    )
406
);
407

    
408
CREATE TABLE IF NOT EXISTS Units (
409
    UID         TEXT NOT NULL,
410
    [Key]       TEXT NOT NULL,
411
    Value       TEXT NOT NULL,
412
    CONSTRAINT PK_Units PRIMARY KEY (
413
        UID
414
    ),
415
    CONSTRAINT UQ_Units UNIQUE (
416
        [Key],
417
        Value
418
    )
419
);
420

    
421
CREATE TABLE IF NOT EXISTS HMBUnits (
422
    UID                 TEXT NOT NULL,
423
    COLUMN_NAME         TEXT NOT NULL,
424
    Units_Expression    TEXT,
425
    CONSTRAINT PK_HMBUnits PRIMARY KEY (
426
        UID
427
    ),
428
    CONSTRAINT UQ_HMBUnits UNIQUE (
429
        COLUMN_NAME
430
    )
431
);
432

    
433

    
434
CREATE TABLE IF NOT EXISTS Schedule (
435
    UID                 TEXT NOT NULL,
436
    [No]                TEXT NOT NULL,
437
    CONSTRAINT PK_Schedule PRIMARY KEY (
438
        UID
439
    ),
440
    CONSTRAINT UQ_Schedule UNIQUE (
441
        [No]
442
    )
443
);
444

    
445

    
446
CREATE TABLE IF NOT EXISTS InsideDiameter (
447
    UID                 TEXT NOT NULL,
448
    NominalDiameter_UID TEXT NOT NULL,
449
    Schedule_UID        TEXT NOT NULL,
450
    Milimeter           REAL,
451
    Inch                REAL,
452
    CONSTRAINT PK_InsideDiameter PRIMARY KEY (
453
        UID
454
    ),
455
    CONSTRAINT FK_NominalDiameter_UID FOREIGN KEY (
456
        NominalDiameter_UID
457
    )
458
    REFERENCES NominalDiameter (UID),
459
    CONSTRAINT FK_Schedule_UID FOREIGN KEY (
460
        Schedule_UID
461
    )
462
    REFERENCES Schedule (UID),
463
    CONSTRAINT UQ_InsideDiameter UNIQUE (
464
        NominalDiameter_UID,
465
        Schedule_UID
466
    )
467
);
468

    
469
CREATE TABLE ResistanceCoefficient (
470
    UID      TEXT NOT NULL,
471
    Method   TEXT NOT NULL,
472
    Category TEXT NOT NULL,
473
    Type     TEXT NOT NULL,
474
    K        REAL NOT NULL,
475
    CONSTRAINT PK_ResistanceCoefficient PRIMARY KEY (
476
        UID
477
    ),
478
    CONSTRAINT UQ_ResistanceCoefficient UNIQUE (
479
        Method,
480
        Category,
481
        Type
482
    )
483
);
클립보드 이미지 추가 (최대 크기: 500 MB)