File indexing completed on 2024-05-19 05:41:54

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