Skip to content

Commit

Permalink
pref: create index for the hash field of tb_level
Browse files Browse the repository at this point in the history
  • Loading branch information
ShenMian committed Jan 15, 2024
1 parent b74ef6f commit b748c67
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ impl Database {
date DATE NOT NULL
)
";
const CREATE_LEVEL_INDICES: &str =
"CREATE UNIQUE INDEX IF NOT EXISTS hash ON tb_level(hash)";
const CREATE_SOLUTION_TABLE: &str = "
CREATE TABLE IF NOT EXISTS tb_solution (
level_id INTEGER PRIMARY KEY,
Expand All @@ -58,6 +60,7 @@ impl Database {
";

self.connection.execute(CREATE_LEVEL_TABLE, ()).unwrap();
self.connection.execute(CREATE_LEVEL_INDICES, ()).unwrap();
self.connection.execute(CREATE_SOLUTION_TABLE, ()).unwrap();
self.connection.execute(CREATE_SESSION_TABLE, ()).unwrap();
}
Expand Down

0 comments on commit b748c67

Please sign in to comment.