2 CREATE TABLE workspace (workspace_id integer PRIMARY KEY AUTOINCREMENT,
3 workspace_name varchar (50) not null unique,
7 CREATE TABLE project (project_id integer PRIMARY KEY AUTOINCREMENT,
8 project_name varchar (50) not null unique,
9 wrkspace_id integer REFERENCES workspace (workspace_id),
13 CREATE TABLE file_include (file_include_id integer PRIMARY KEY AUTOINCREMENT,
14 file_include_type varchar (10) not null unique
17 CREATE TABLE ext_include (prj_id integer REFERENCES project (project_id),
18 file_incl_id integer REFERENCES file_include (file_include_id),
19 PRIMARY KEY (prj_id, file_incl_id)
22 CREATE TABLE file_ignore (file_ignore_id integer PRIMARY KEY AUTOINCREMENT,
23 file_ignore_type varchar (10) unique
26 CREATE TABLE ext_ignore (prj_id integer REFERENCES project (project_id),
27 file_ign_id integer REFERENCES file_ignore (file_ignore_id),
28 PRIMARY KEY (prj_id, file_ign_id)
31 CREATE TABLE file (file_id integer PRIMARY KEY AUTOINCREMENT,
32 file_path TEXT not null unique,
33 prj_id integer REFERENCES project (projec_id),
34 lang_id integer REFERENCES language (language_id),
38 CREATE TABLE language (language_id integer PRIMARY KEY AUTOINCREMENT,
39 language_name varchar (50) not null unique);
41 CREATE TABLE symbol (symbol_id integer PRIMARY KEY AUTOINCREMENT,
42 file_defined_id integer not null REFERENCES file (file_id),
43 name varchar (256) not null,
44 file_position integer,
45 is_file_scope integer,
46 signature varchar (256),
47 scope_definition_id integer,
49 type_id integer REFERENCES sym_type (type_id),
50 kind_id integer REFERENCES sym_kind (sym_kind_id),
51 access_kind_id integer REFERENCES sym_access (sym_access_id),
52 implementation_kind_id integer REFERENCES sym_implementation (sym_impl_id),
53 update_flag integer default 0,
54 unique (name, file_defined_id, file_position)
57 CREATE TABLE sym_type (type_id integer PRIMARY KEY AUTOINCREMENT,
58 type_type varchar (256) not null,
59 type_name varchar (256) not null,
60 unique (type_type, type_name)
63 CREATE TABLE sym_kind (sym_kind_id integer PRIMARY KEY AUTOINCREMENT,
64 kind_name varchar (50) not null unique
67 CREATE TABLE sym_access (access_kind_id integer PRIMARY KEY AUTOINCREMENT,
68 access_name varchar (50) not null unique
71 CREATE TABLE sym_implementation (sym_impl_id integer PRIMARY KEY AUTOINCREMENT,
72 implementation_name varchar (50) not null unique
75 CREATE TABLE heritage (symbol_id_base integer REFERENCES symbol (symbol_id),
76 symbol_id_derived integer REFERENCES symbol (symbol_id),
77 PRIMARY KEY (symbol_id_base, symbol_id_derived)
80 CREATE TABLE scope (scope_id integer PRIMARY KEY AUTOINCREMENT,
81 scope_name varchar(256) not null,
83 unique (scope_name, type_id)
86 CREATE TABLE __tmp_heritage_scope (tmp_heritage_scope_id integer PRIMARY KEY AUTOINCREMENT,
87 symbol_referer_id integer not null,
88 field_inherits varchar(256),
89 field_struct varchar(256),
90 field_typeref varchar(256),
91 field_enum varchar(256),
92 field_union varchar(256),
93 field_class varchar(256),
94 field_namespace varchar(256)
97 CREATE TABLE __tmp_removed (tmp_removed_id integer PRIMARY KEY AUTOINCREMENT,
98 symbol_removed_id integer not null
101 CREATE INDEX symbol_idx_1 ON symbol (name);
103 CREATE INDEX symbol_idx_2 ON symbol (name, file_defined_id, file_position);
105 CREATE INDEX scope_idx_1 ON scope (scope_name);
107 CREATE INDEX scope_idx_2 ON scope (scope_name, type_id);
109 CREATE INDEX file_idx_1 ON file (file_path);
111 CREATE INDEX sym_type_idx_1 ON sym_type (type_type);
113 CREATE INDEX sym_type_idx_2 ON sym_type (type_type, type_name);
115 CREATE TRIGGER delete_file_trg BEFORE DELETE ON file
118 DELETE FROM symbol WHERE file_defined_id = (SELECT file_id FROM file WHERE file_path = old.file_path);
121 CREATE TRIGGER delete_symbol_trg BEFORE DELETE ON symbol
124 DELETE FROM scope WHERE scope.scope_id=old.scope_definition_id;
125 DELETE FROM sym_type WHERE sym_type.type_id=old.type_id;
126 UPDATE symbol SET scope_id='-1' WHERE symbol.scope_id=old.scope_definition_id AND symbol.scope_id > 0;
127 INSERT INTO __tmp_removed (symbol_removed_id) VALUES (old.symbol_id);