From e0331921eea05d4b57bc4e3f0d21ad1d44d49107 Mon Sep 17 00:00:00 2001 From: davidemazzocchi Date: Tue, 30 Sep 2025 15:51:56 +0200 Subject: [PATCH] feat: add entity_class and attribute_id indexes to db structure --- 01.workspace/heave/src/fun/sqlite_init_db.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/01.workspace/heave/src/fun/sqlite_init_db.rs b/01.workspace/heave/src/fun/sqlite_init_db.rs index f6a8e99..224e5e3 100644 --- a/01.workspace/heave/src/fun/sqlite_init_db.rs +++ b/01.workspace/heave/src/fun/sqlite_init_db.rs @@ -18,9 +18,14 @@ pub fn run(path: &path::Path) { 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 ); + 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 _result = connection.execute_batch(init_statement); + if _result.is_err() { + panic!(); + } } #[cfg(test)]