File indexing completed on 2024-05-19 05:41:54
0001 BEGIN TRANSACTION; 0002 DROP TABLE IF EXISTS "db_option"; 0003 CREATE TABLE IF NOT EXISTS "db_option" ( 0004 "key" integer NOT NULL, 0005 "value" integer NOT NULL, 0006 PRIMARY KEY("key") 0007 ); 0008 DROP TABLE IF EXISTS "source_file"; 0009 CREATE TABLE IF NOT EXISTS "source_file" ( 0010 "id" integer, 0011 "version" integer NOT NULL, 0012 "package_id" bigint, 0013 "component_id" bigint, 0014 "name" text NOT NULL, 0015 "qualified_name" text NOT NULL, 0016 "is_header" boolean NOT NULL, 0017 "hash" text NOT NULL, 0018 CONSTRAINT "fk_source_file_package" FOREIGN KEY("package_id") REFERENCES "source_package"("id") deferrable initially deferred, 0019 CONSTRAINT "fk_source_file_component" FOREIGN KEY("component_id") REFERENCES "source_component"("id") deferrable initially deferred, 0020 PRIMARY KEY("id" AUTOINCREMENT) 0021 ); 0022 DROP TABLE IF EXISTS "error_messages"; 0023 CREATE TABLE IF NOT EXISTS "error_messages" ( 0024 "id" integer, 0025 "version" integer NOT NULL, 0026 "error_kind" integer NOT NULL, 0027 "fully_qualified_name" text NOT NULL, 0028 "error_message" text NOT NULL, 0029 "file_name" text NOT NULL, 0030 PRIMARY KEY("id" AUTOINCREMENT) 0031 ); 0032 DROP TABLE IF EXISTS "source_package"; 0033 CREATE TABLE IF NOT EXISTS "source_package" ( 0034 "id" integer, 0035 "version" integer NOT NULL, 0036 "parent_id" bigint, 0037 "source_repository_id" bigint, 0038 "name" text NOT NULL, 0039 "qualified_name" text NOT NULL, 0040 "disk_path" text NOT NULL, 0041 CONSTRAINT "fk_source_package_source_repository" FOREIGN KEY("source_repository_id") REFERENCES "source_repository"("id") deferrable initially deferred, 0042 CONSTRAINT "fk_source_package_parent" FOREIGN KEY("parent_id") REFERENCES "source_package"("id") deferrable initially deferred, 0043 PRIMARY KEY("id" AUTOINCREMENT) 0044 ); 0045 DROP TABLE IF EXISTS "class_hierarchy"; 0046 CREATE TABLE IF NOT EXISTS "class_hierarchy" ( 0047 "target_id" bigint, 0048 "source_id" bigint, 0049 CONSTRAINT "fk_class_hierarchy_source" FOREIGN KEY("source_id") REFERENCES "class_declaration"("id") deferrable initially deferred, 0050 PRIMARY KEY("target_id", "source_id"), 0051 CONSTRAINT "fk_class_hierarchy_target" FOREIGN KEY("target_id") REFERENCES "class_declaration"("id") deferrable initially deferred 0052 ); 0053 DROP TABLE IF EXISTS "includes"; 0054 CREATE TABLE IF NOT EXISTS "includes" ( 0055 "target_id" bigint, 0056 "source_id" bigint, 0057 CONSTRAINT "fk_includes_source" FOREIGN KEY("source_id") REFERENCES "source_file"("id") deferrable initially deferred, 0058 CONSTRAINT "fk_includes_target" FOREIGN KEY("target_id") REFERENCES "source_file"("id") deferrable initially deferred, 0059 PRIMARY KEY("target_id", "source_id") 0060 ); 0061 DROP TABLE IF EXISTS "source_component"; 0062 CREATE TABLE IF NOT EXISTS "source_component" ( 0063 "id" integer, 0064 "version" integer NOT NULL, 0065 "qualified_name" text NOT NULL, 0066 "name" text NOT NULL, 0067 "package_id" bigint, 0068 CONSTRAINT "fk_source_component_package" FOREIGN KEY("package_id") REFERENCES "source_package"("id") deferrable initially deferred, 0069 PRIMARY KEY("id" AUTOINCREMENT) 0070 ); 0071 DROP TABLE IF EXISTS "class_declaration"; 0072 CREATE TABLE IF NOT EXISTS "class_declaration" ( 0073 "id" integer, 0074 "version" integer NOT NULL, 0075 "parent_namespace_id" bigint, 0076 "class_namespace_id" bigint, 0077 "parent_package_id" bigint, 0078 "name" text NOT NULL, 0079 "qualified_name" text NOT NULL, 0080 "kind" integer NOT NULL, 0081 "access" integer NOT NULL, 0082 CONSTRAINT "fk_class_declaration_parent_package" FOREIGN KEY("parent_package_id") REFERENCES "source_package"("id") deferrable initially deferred, 0083 CONSTRAINT "fk_class_declaration_parent_namespace" FOREIGN KEY("parent_namespace_id") REFERENCES "namespace_declaration"("id") deferrable initially deferred, 0084 CONSTRAINT "fk_class_declaration_class_namespace" FOREIGN KEY("class_namespace_id") REFERENCES "class_declaration"("id") deferrable initially deferred, 0085 PRIMARY KEY("id" AUTOINCREMENT) 0086 ); 0087 DROP TABLE IF EXISTS "field_declaration"; 0088 CREATE TABLE IF NOT EXISTS "field_declaration" ( 0089 "id" integer, 0090 "version" integer NOT NULL, 0091 "class_id" bigint, 0092 "name" text NOT NULL, 0093 "qualified_name" text NOT NULL, 0094 "signature" text NOT NULL, 0095 "access" integer NOT NULL, 0096 "is_static" boolean NOT NULL, 0097 PRIMARY KEY("id" AUTOINCREMENT), 0098 CONSTRAINT "fk_field_declaration_class" FOREIGN KEY("class_id") REFERENCES "class_declaration"("id") deferrable initially deferred 0099 ); 0100 DROP TABLE IF EXISTS "source_repository"; 0101 CREATE TABLE IF NOT EXISTS "source_repository" ( 0102 "id" integer, 0103 "version" integer NOT NULL, 0104 "name" text NOT NULL, 0105 "qualified_name" text NOT NULL, 0106 "disk_path" text NOT NULL, 0107 PRIMARY KEY("id" AUTOINCREMENT) 0108 ); 0109 DROP TABLE IF EXISTS "component_relation"; 0110 CREATE TABLE IF NOT EXISTS "component_relation" ( 0111 "target_id" bigint, 0112 "source_id" bigint, 0113 PRIMARY KEY("target_id", "source_id"), 0114 CONSTRAINT "fk_component_relation_source" FOREIGN KEY("source_id") REFERENCES "source_component"("id") deferrable initially deferred, 0115 CONSTRAINT "fk_component_relation_target" FOREIGN KEY("target_id") REFERENCES "source_component"("id") deferrable initially deferred 0116 ); 0117 DROP TABLE IF EXISTS "method_declaration"; 0118 CREATE TABLE IF NOT EXISTS "method_declaration" ( 0119 "id" integer, 0120 "version" integer NOT NULL, 0121 "class_id" bigint, 0122 "name" text NOT NULL, 0123 "qualified_name" text NOT NULL, 0124 "signature" text NOT NULL, 0125 "return_type" text NOT NULL, 0126 "template_parameters" text NOT NULL, 0127 "access" integer NOT NULL, 0128 "is_virtual" boolean NOT NULL, 0129 "is_pure" boolean NOT NULL, 0130 "is_static" boolean NOT NULL, 0131 "is_const" boolean NOT NULL, 0132 PRIMARY KEY("id" AUTOINCREMENT), 0133 CONSTRAINT "fk_method_declaration_class" FOREIGN KEY("class_id") REFERENCES "class_declaration"("id") deferrable initially deferred 0134 ); 0135 DROP TABLE IF EXISTS "function_declaration"; 0136 CREATE TABLE IF NOT EXISTS "function_declaration" ( 0137 "id" integer, 0138 "version" integer NOT NULL, 0139 "namespace_id" bigint, 0140 "name" text NOT NULL, 0141 "qualified_name" text NOT NULL, 0142 "signature" text NOT NULL, 0143 "return_type" text NOT NULL, 0144 "template_parameters" text NOT NULL, 0145 CONSTRAINT "fk_function_declaration_namespace" FOREIGN KEY("namespace_id") REFERENCES "namespace_declaration"("id") deferrable initially deferred, 0146 PRIMARY KEY("id" AUTOINCREMENT) 0147 ); 0148 DROP TABLE IF EXISTS "variable_declaration"; 0149 CREATE TABLE IF NOT EXISTS "variable_declaration" ( 0150 "id" integer, 0151 "version" integer NOT NULL, 0152 "namespace_id" bigint, 0153 "name" text NOT NULL, 0154 "qualified_name" text NOT NULL, 0155 "signature" text NOT NULL, 0156 "is_global" boolean NOT NULL, 0157 PRIMARY KEY("id" AUTOINCREMENT), 0158 CONSTRAINT "fk_variable_declaration_namespace" FOREIGN KEY("namespace_id") REFERENCES "namespace_declaration"("id") deferrable initially deferred 0159 ); 0160 DROP TABLE IF EXISTS "namespace_declaration"; 0161 CREATE TABLE IF NOT EXISTS "namespace_declaration" ( 0162 "id" integer, 0163 "version" integer NOT NULL, 0164 "parent_id" bigint, 0165 "name" text NOT NULL, 0166 "qualified_name" text NOT NULL, 0167 CONSTRAINT "fk_namespace_declaration_parent" FOREIGN KEY("parent_id") REFERENCES "namespace_declaration"("id") deferrable initially deferred, 0168 PRIMARY KEY("id" AUTOINCREMENT) 0169 ); 0170 DROP TABLE IF EXISTS "uses_in_the_interface"; 0171 CREATE TABLE IF NOT EXISTS "uses_in_the_interface" ( 0172 "target_id" bigint, 0173 "source_id" bigint, 0174 PRIMARY KEY("target_id", "source_id"), 0175 CONSTRAINT "fk_uses_in_the_interface_target" FOREIGN KEY("target_id") REFERENCES "class_declaration"("id") deferrable initially deferred, 0176 CONSTRAINT "fk_uses_in_the_interface_source" FOREIGN KEY("source_id") REFERENCES "class_declaration"("id") deferrable initially deferred 0177 ); 0178 DROP TABLE IF EXISTS "dependencies"; 0179 CREATE TABLE IF NOT EXISTS "dependencies" ( 0180 "target_id" bigint, 0181 "source_id" bigint, 0182 CONSTRAINT "fk_dependencies_target" FOREIGN KEY("target_id") REFERENCES "source_package"("id") deferrable initially deferred, 0183 PRIMARY KEY("target_id", "source_id"), 0184 CONSTRAINT "fk_dependencies_source" FOREIGN KEY("source_id") REFERENCES "source_package"("id") deferrable initially deferred 0185 ); 0186 DROP TABLE IF EXISTS "uses_in_the_implementation"; 0187 CREATE TABLE IF NOT EXISTS "uses_in_the_implementation" ( 0188 "target_id" bigint, 0189 "source_id" bigint, 0190 PRIMARY KEY("target_id", "source_id"), 0191 CONSTRAINT "fk_uses_in_the_implementation_target" FOREIGN KEY("target_id") REFERENCES "class_declaration"("id") deferrable initially deferred, 0192 CONSTRAINT "fk_uses_in_the_implementation_source" FOREIGN KEY("source_id") REFERENCES "class_declaration"("id") deferrable initially deferred 0193 ); 0194 DROP TABLE IF EXISTS "function_calls"; 0195 CREATE TABLE IF NOT EXISTS "function_calls" ( 0196 "caller_id" bigint, 0197 "callee_id" bigint, 0198 PRIMARY KEY("caller_id", "callee_id"), 0199 CONSTRAINT "fk_function_calls_caller" FOREIGN KEY("caller_id") REFERENCES "function_declaration"("id") deferrable initially deferred, 0200 CONSTRAINT "fk_function_calls_cellee" FOREIGN KEY("callee_id") REFERENCES "function_declaration"("id") deferrable initially deferred 0201 ); 0202 DROP TABLE IF EXISTS "namespace_source_file"; 0203 CREATE TABLE IF NOT EXISTS "namespace_source_file" ( 0204 "source_file_id" bigint NOT NULL, 0205 "namespace_id" bigint NOT NULL, 0206 PRIMARY KEY("source_file_id","namespace_id"), 0207 CONSTRAINT "fk_namespace_source_file_key1" FOREIGN KEY("source_file_id") REFERENCES "source_file"("id") on delete cascade deferrable initially deferred, 0208 CONSTRAINT "fk_namespace_source_file_key2" FOREIGN KEY("namespace_id") REFERENCES "namespace_declaration"("id") on delete cascade deferrable initially deferred 0209 ); 0210 DROP TABLE IF EXISTS "class_source_file"; 0211 CREATE TABLE IF NOT EXISTS "class_source_file" ( 0212 "source_file_id" bigint NOT NULL, 0213 "class_id" bigint NOT NULL, 0214 CONSTRAINT "fk_class_source_file_key1" FOREIGN KEY("source_file_id") REFERENCES "source_file"("id") on delete cascade deferrable initially deferred, 0215 CONSTRAINT "fk_class_source_file_key2" FOREIGN KEY("class_id") REFERENCES "class_declaration"("id") on delete cascade deferrable initially deferred, 0216 PRIMARY KEY("source_file_id","class_id") 0217 ); 0218 DROP TABLE IF EXISTS "udt_component"; 0219 CREATE TABLE IF NOT EXISTS "udt_component" ( 0220 "component_id" bigint NOT NULL, 0221 "udt_id" bigint NOT NULL, 0222 CONSTRAINT "fk_udt_component_key1" FOREIGN KEY("component_id") REFERENCES "source_component"("id") on delete cascade deferrable initially deferred, 0223 PRIMARY KEY("component_id","udt_id"), 0224 CONSTRAINT "fk_udt_component_key2" FOREIGN KEY("udt_id") REFERENCES "class_declaration"("id") on delete cascade deferrable initially deferred 0225 ); 0226 DROP TABLE IF EXISTS "method_argument_class"; 0227 CREATE TABLE IF NOT EXISTS "method_argument_class" ( 0228 "type_class_id" bigint NOT NULL, 0229 "method_id" bigint NOT NULL, 0230 PRIMARY KEY("type_class_id","method_id"), 0231 CONSTRAINT "fk_method_argument_class_key2" FOREIGN KEY("method_id") REFERENCES "method_declaration"("id") on delete cascade deferrable initially deferred, 0232 CONSTRAINT "fk_method_argument_class_key1" FOREIGN KEY("type_class_id") REFERENCES "class_declaration"("id") on delete cascade deferrable initially deferred 0233 ); 0234 DROP TABLE IF EXISTS "field_type"; 0235 CREATE TABLE IF NOT EXISTS "field_type" ( 0236 "type_class_id" bigint NOT NULL, 0237 "field_id" bigint NOT NULL, 0238 PRIMARY KEY("type_class_id","field_id"), 0239 CONSTRAINT "fk_field_type_key2" FOREIGN KEY("field_id") REFERENCES "field_declaration"("id") on delete cascade deferrable initially deferred, 0240 CONSTRAINT "fk_field_type_key1" FOREIGN KEY("type_class_id") REFERENCES "class_declaration"("id") on delete cascade deferrable initially deferred 0241 ); 0242 DROP TABLE IF EXISTS "global_function_source_file"; 0243 CREATE TABLE IF NOT EXISTS "global_function_source_file" ( 0244 "source_file_id" bigint, 0245 "function_id" bigint, 0246 PRIMARY KEY("source_file_id", "function_id"), 0247 CONSTRAINT "fk_global_function_source_file_source_id" FOREIGN KEY("source_file_id") REFERENCES "source_file"("id") deferrable initially deferred, 0248 CONSTRAINT "fk_global_function_source_file_function_id" FOREIGN KEY("function_id") REFERENCES "function_declaration"("id") deferrable initially deferred 0249 ); 0250 0251 DROP INDEX IF EXISTS "namespace_source_file_source_file_source_file"; 0252 CREATE INDEX IF NOT EXISTS "namespace_source_file_source_file_source_file" ON "namespace_source_file" ( 0253 "source_file_id" 0254 ); 0255 DROP INDEX IF EXISTS "namespace_source_file_namespace_declaration_namespace"; 0256 CREATE INDEX IF NOT EXISTS "namespace_source_file_namespace_declaration_namespace" ON "namespace_source_file" ( 0257 "namespace_id" 0258 ); 0259 DROP INDEX IF EXISTS "class_source_file_source_file_source_file"; 0260 CREATE INDEX IF NOT EXISTS "class_source_file_source_file_source_file" ON "class_source_file" ( 0261 "source_file_id" 0262 ); 0263 DROP INDEX IF EXISTS "class_source_file_class_declaration_class"; 0264 CREATE INDEX IF NOT EXISTS "class_source_file_class_declaration_class" ON "class_source_file" ( 0265 "class_id" 0266 ); 0267 DROP INDEX IF EXISTS "udt_component_source_component_component"; 0268 CREATE INDEX IF NOT EXISTS "udt_component_source_component_component" ON "udt_component" ( 0269 "component_id" 0270 ); 0271 DROP INDEX IF EXISTS "udt_component_class_declaration_udt"; 0272 CREATE INDEX IF NOT EXISTS "udt_component_class_declaration_udt" ON "udt_component" ( 0273 "udt_id" 0274 ); 0275 DROP INDEX IF EXISTS "method_argument_class_class_declaration_type_class"; 0276 CREATE INDEX IF NOT EXISTS "method_argument_class_class_declaration_type_class" ON "method_argument_class" ( 0277 "type_class_id" 0278 ); 0279 DROP INDEX IF EXISTS "method_argument_class_method_declaration_method"; 0280 CREATE INDEX IF NOT EXISTS "method_argument_class_method_declaration_method" ON "method_argument_class" ( 0281 "method_id" 0282 ); 0283 DROP INDEX IF EXISTS "field_type_class_declaration_type_class"; 0284 CREATE INDEX IF NOT EXISTS "field_type_class_declaration_type_class" ON "field_type" ( 0285 "type_class_id" 0286 ); 0287 DROP INDEX IF EXISTS "field_type_field_declaration_field"; 0288 CREATE INDEX IF NOT EXISTS "field_type_field_declaration_field" ON "field_type" ( 0289 "field_id" 0290 ); 0291 DROP INDEX IF EXISTS "source_repository_qualified_name"; 0292 CREATE INDEX IF NOT EXISTS "source_repository_qualified_name" ON "source_repository" ( 0293 "qualified_name" 0294 ); 0295 DROP INDEX IF EXISTS "class_declaration_qualified_name"; 0296 CREATE INDEX IF NOT EXISTS "class_declaration_qualified_name" ON "class_declaration" ( 0297 "qualified_name" 0298 ); 0299 DROP INDEX IF EXISTS "class_hierarchy_target_id"; 0300 CREATE INDEX IF NOT EXISTS "class_hierarchy_target_id" ON "class_hierarchy" ( 0301 "target_id" 0302 ); 0303 DROP INDEX IF EXISTS "class_hierarchy_source_id"; 0304 CREATE INDEX IF NOT EXISTS "class_hierarchy_source_id" ON "class_hierarchy" ( 0305 "source_id" 0306 ); 0307 DROP INDEX IF EXISTS "component_relation_target_id"; 0308 CREATE INDEX IF NOT EXISTS "component_relation_target_id" ON "component_relation" ( 0309 "target_id" 0310 ); 0311 DROP INDEX IF EXISTS "component_relation_source_id"; 0312 CREATE INDEX IF NOT EXISTS "component_relation_source_id" ON "component_relation" ( 0313 "source_id" 0314 ); 0315 DROP INDEX IF EXISTS "dependencies_target_id"; 0316 CREATE INDEX IF NOT EXISTS "dependencies_target_id" ON "dependencies" ( 0317 "target_id" 0318 ); 0319 DROP INDEX IF EXISTS "dependencies_source_id"; 0320 CREATE INDEX IF NOT EXISTS "dependencies_source_id" ON "dependencies" ( 0321 "source_id" 0322 ); 0323 DROP INDEX IF EXISTS "field_declaration_qualified_name"; 0324 CREATE INDEX IF NOT EXISTS "field_declaration_qualified_name" ON "field_declaration" ( 0325 "qualified_name" 0326 ); 0327 DROP INDEX IF EXISTS "function_declaration_qualified_name"; 0328 CREATE INDEX IF NOT EXISTS "function_declaration_qualified_name" ON "function_declaration" ( 0329 "qualified_name" 0330 ); 0331 DROP INDEX IF EXISTS "function_declaration_signature"; 0332 CREATE INDEX IF NOT EXISTS "function_declaration_signature" ON "function_declaration" ( 0333 "signature" 0334 ); 0335 DROP INDEX IF EXISTS "includes_target_id"; 0336 CREATE INDEX IF NOT EXISTS "includes_target_id" ON "includes" ( 0337 "target_id" 0338 ); 0339 DROP INDEX IF EXISTS "includes_source_id"; 0340 CREATE INDEX IF NOT EXISTS "includes_source_id" ON "includes" ( 0341 "source_id" 0342 ); 0343 DROP INDEX IF EXISTS "method_declaration_qualified_name"; 0344 CREATE INDEX IF NOT EXISTS "method_declaration_qualified_name" ON "method_declaration" ( 0345 "qualified_name" 0346 ); 0347 DROP INDEX IF EXISTS "method_declaration_signature"; 0348 CREATE INDEX IF NOT EXISTS "method_declaration_signature" ON "method_declaration" ( 0349 "signature" 0350 ); 0351 DROP INDEX IF EXISTS "namespace_declaration_qualified_name"; 0352 CREATE INDEX IF NOT EXISTS "namespace_declaration_qualified_name" ON "namespace_declaration" ( 0353 "qualified_name" 0354 ); 0355 DROP INDEX IF EXISTS "source_component_qualified_name"; 0356 CREATE INDEX IF NOT EXISTS "source_component_qualified_name" ON "source_component" ( 0357 "qualified_name" 0358 ); 0359 DROP INDEX IF EXISTS "source_file_qualified_name"; 0360 CREATE INDEX IF NOT EXISTS "source_file_qualified_name" ON "source_file" ( 0361 "qualified_name" 0362 ); 0363 DROP INDEX IF EXISTS "source_package_qualified_name"; 0364 CREATE INDEX IF NOT EXISTS "source_package_qualified_name" ON "source_package" ( 0365 "qualified_name" 0366 ); 0367 DROP INDEX IF EXISTS "uses_in_the_implementation_target_id"; 0368 CREATE INDEX IF NOT EXISTS "uses_in_the_implementation_target_id" ON "uses_in_the_implementation" ( 0369 "target_id" 0370 ); 0371 DROP INDEX IF EXISTS "uses_in_the_implementation_source_id"; 0372 CREATE INDEX IF NOT EXISTS "uses_in_the_implementation_source_id" ON "uses_in_the_implementation" ( 0373 "source_id" 0374 ); 0375 DROP INDEX IF EXISTS "uses_in_the_interface_target_id"; 0376 CREATE INDEX IF NOT EXISTS "uses_in_the_interface_target_id" ON "uses_in_the_interface" ( 0377 "target_id" 0378 ); 0379 DROP INDEX IF EXISTS "uses_in_the_interface_source_id"; 0380 CREATE INDEX IF NOT EXISTS "uses_in_the_interface_source_id" ON "uses_in_the_interface" ( 0381 "source_id" 0382 ); 0383 DROP INDEX IF EXISTS "variable_declaration_qualified_name"; 0384 CREATE INDEX IF NOT EXISTS "variable_declaration_qualified_name" ON "variable_declaration" ( 0385 "qualified_name" 0386 ); 0387 DROP INDEX IF EXISTS "global_function_source_file_id"; 0388 CREATE INDEX IF NOT EXISTS "global_function_source_file_id" ON "global_function_source_file" ( 0389 "id" 0390 ); 0391 0392 COMMIT;