PageRenderTime 31ms CodeModel.GetById 12ms app.highlight 15ms RepoModel.GetById 1ms app.codeStats 1ms

/DetectorDescription/OnlineDBLoader/scripts/CMS_DTCTR_GEOMETRY_OWNER/loading-scripts/truncatetables.sql

https://github.com/aivanov-cern/cmssw
SQL | 76 lines | 61 code | 7 blank | 8 comment | 0 complexity | 91f35039b4e1786f466b6182825be82c MD5 | raw file
 1truncate table CMSINTEGRATION.BOOLEANSOLIDS;
 2truncate table CMSINTEGRATION.BOXES;
 3truncate table CMSINTEGRATION.CATEGORIES;
 4truncate table CMSINTEGRATION.COMPOSITEMATERIALS;
 5truncate table CMSINTEGRATION.CONES;
 6truncate table CMSINTEGRATION.ELEMENTARYMATERIALS;
 7-- due to use of this table by other database schemas,
 8-- this needs to be a special delete, not truncate table CMSINTEGRATION.LOGICALPARTTYPES;
 9truncate table CMSINTEGRATION.DETECTORPARTS;
10truncate table CMSINTEGRATION.MATERIALFRACTIONS;
11truncate table CMSINTEGRATION.NOMINALPLACEMENTS;
12truncate table CMSINTEGRATION.PHYSICALPARTSTREE;
13truncate table CMSINTEGRATION.POLYCONES;
14truncate table CMSINTEGRATION.POLYHEDRA;
15truncate table CMSINTEGRATION.POSPARTSGRAPH;
16truncate table CMSINTEGRATION.PSEUDOTRAPEZOIDS;
17truncate table CMSINTEGRATION.ROTATIONS;
18truncate table CMSINTEGRATION.RELPLACEMENTS;
19
20alter table BOOLEANSOLIDS DISABLE CONSTRAINT  BOO_SOL_FK;
21alter table BOOLEANSOLIDS DISABLE CONSTRAINT  BOO_SOL_FK_LEFTSOLIDNAME_FK;
22alter table BOOLEANSOLIDS DISABLE CONSTRAINT  BOO_SOL_FK_RIGHTSOLIDNAME_FK;
23alter table BOXES DISABLE CONSTRAINT  BOX_SOL_FK;
24alter table CONES DISABLE CONSTRAINT  CON_SOL_FK;
25alter table DETECTORPARTS DISABLE CONSTRAINT  DLP_SOL_FK;
26alter table POLYCONES DISABLE CONSTRAINT  POL_SOL_FK;     
27alter table POLYHEDRA DISABLE CONSTRAINT  POLH_SOL_FK;
28alter table PSEUDOTRAPEZOIDS DISABLE CONSTRAINT  PSE_SOL_FK;
29alter table REFLECTIONSOLIDS DISABLE CONSTRAINT  REF_SOL_FK;        
30alter table REFLECTIONSOLIDS DISABLE CONSTRAINT  REFFK_REFLECTIONSOLIDSOLIDN_FK; 
31alter table TRAPEZOIDS DISABLE CONSTRAINT  TRA_SOL_FK; 
32alter table TRD1S DISABLE CONSTRAINT  TRD_SOL_FK; 
33alter table TUBES DISABLE CONSTRAINT  TUB1_SOL_FK;    
34
35truncate table CMSINTEGRATION.SOLIDS;
36
37alter table BOOLEANSOLIDS ENABLE CONSTRAINT  BOO_SOL_FK;
38alter table BOOLEANSOLIDS ENABLE CONSTRAINT  BOO_SOL_FK_LEFTSOLIDNAME_FK;
39alter table BOOLEANSOLIDS ENABLE CONSTRAINT  BOO_SOL_FK_RIGHTSOLIDNAME_FK;
40alter table BOXES ENABLE CONSTRAINT  BOX_SOL_FK;
41alter table CONES ENABLE CONSTRAINT  CON_SOL_FK;
42alter table DETECTORPARTS ENABLE CONSTRAINT  DLP_SOL_FK;
43alter table POLYCONES ENABLE CONSTRAINT  POL_SOL_FK;     
44alter table POLYHEDRA ENABLE CONSTRAINT  POLH_SOL_FK;
45alter table PSEUDOTRAPEZOIDS ENABLE CONSTRAINT  PSE_SOL_FK;
46alter table REFLECTIONSOLIDS ENABLE CONSTRAINT  REF_SOL_FK;        
47alter table REFLECTIONSOLIDS ENABLE CONSTRAINT  REFFK_REFLECTIONSOLIDSOLIDN_FK; 
48alter table TRAPEZOIDS ENABLE CONSTRAINT  TRA_SOL_FK; 
49alter table TRD1S ENABLE CONSTRAINT  TRD_SOL_FK; 
50alter table TUBES ENABLE CONSTRAINT  TUB1_SOL_FK;    
51
52
53truncate table CMSINTEGRATION.TRAPEZOIDS;
54truncate table CMSINTEGRATION.TRD1S;
55truncate table CMSINTEGRATION.TUBES;
56truncate table CMSINTEGRATION.ZSECTIONS;
57
58--COMPOSITEMATERIALS             COM_MAT_FK
59--DETECTORPARTS                  DLP_MAT_FK
60--ELEMENTARYMATERIALS            ELE_MAT_FK
61--MATERIALFRACTIONS              MATFRAC_MAT_FK
62--SOLIDS                         SOL_MAT_FK
63alter table CMSINTEGRATION.MATERIALFRACTIONS disable constraint MATFRAC_MAT_FK;
64alter table CMSINTEGRATION.ELEMENTARYMATERIALS disable constraint ELE_MAT_FK;
65alter table CMSINTEGRATION.SOLIDS disable constraint SOL_MAT_FK;
66alter table CMSINTEGRATION.DETECTORPARTS disable constraint DLP_MAT_FK;
67alter table CMSINTEGRATION.COMPOSITEMATERIALS disable constraint COM_MAT_FK;
68truncate table CMSINTEGRATION.MATERIALS;
69alter table CMSINTEGRATION.MATERIALFRACTIONS enable constraint MATFRAC_MAT_FK;
70alter table CMSINTEGRATION.ELEMENTARYMATERIALS enable constraint ELE_MAT_FK;
71alter table CMSINTEGRATION.SOLIDS enable constraint SOL_MAT_FK;
72alter table CMSINTEGRATION.DETECTORPARTS enable constraint DLP_MAT_FK;
73alter table CMSINTEGRATION.COMPOSITEMATERIALS enable constraint COM_MAT_FK;
74
75-- WARNING:  This needs to be updated if namespaces from XML change.
76delete from CMSINTEGRATION.LOGICALPARTTYPES where lpname like 'vcal%' or  lpname like 'hcal%' or  lpname like 'cms%' or  lpname like 'beampipe%' or  lpname like 'cavern%' or lpname like 'muon%' or lpname like 'mf%' or lpname like 'mb%' or lpname like 'tec%' or lpname like 'tob%' or lpname like 'tib%' or lpname like 'tid%' or lpname like 'ecal%' or lpname like 'pxlx%' or lpname like 'quadrupole%' or lpname like 'trak%' or lpname like 'malg%' or lpname like 'mgnt%' or lpname like 'MagneticFieldVolumes:%';