feat: add entity_class and attribute_id indexes to db structure

This commit is contained in:
2025-09-30 15:51:56 +02:00
parent 835feb7450
commit e0331921ee

View File

@@ -18,9 +18,14 @@ pub fn run(path: &path::Path) {
CONSTRAINT pk_id PRIMARY KEY (id, entity_id), CONSTRAINT pk_id PRIMARY KEY (id, entity_id),
CONSTRAINT fk_entity_id FOREIGN KEY (entity_id) REFERENCES entity (id) ON DELETE CASCADE ON UPDATE CASCADE CONSTRAINT fk_entity_id FOREIGN KEY (entity_id) REFERENCES entity (id) ON DELETE CASCADE ON UPDATE CASCADE
); );
CREATE INDEX IF NOT EXISTS entity_class ON entity (class);
CREATE INDEX IF NOT EXISTS attribute_id ON attribute (id);
"#; "#;
let connection = Connection::open(path).unwrap(); let connection = Connection::open(path).unwrap();
let _result = connection.execute_batch(init_statement); let _result = connection.execute_batch(init_statement);
if _result.is_err() {
panic!();
}
} }
#[cfg(test)] #[cfg(test)]