Skip to content

Commit

Permalink
Merge pull request #8 from leirn/#2---add-index-to-database
Browse files Browse the repository at this point in the history
Add index
  • Loading branch information
leirn authored Jan 17, 2024
2 parents 84a5a11 + 1c729c6 commit 84608cc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/app/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ pub fn create_tables(app_state: web::Data<AppState>) -> Result<(), Box<dyn Error
wikipedia_link TEXT,
keywords TEXT
);
CREATE INDEX idx_airports_name ON airports (name);
CREATE INDEX idx_airports_municipality ON airports (municipality);
CREATE INDEX idx_airports_iata_code ON airports (iata_code);
CREATE INDEX idx_airports_iso_country ON airports (iso_country);
CREATE INDEX idx_airports_type ON airports (type);
CREATE TABLE IF NOT EXISTS airport_frequencies (
id INTEGER UNIQUE PRIMARY KEY NOT NULL,
airport_ref INTEGER,
Expand Down Expand Up @@ -93,6 +98,11 @@ pub fn create_tables(app_state: web::Data<AppState>) -> Result<(), Box<dyn Error
power TEXT,
associated_airport TEXT
);
CREATE INDEX idx_navaids_name ON navaids (name);
CREATE INDEX idx_navaids_filename ON navaids (filename);
CREATE INDEX idx_navaids_associated_airport ON navaids (associated_airport);
CREATE INDEX idx_navaids_type ON navaids (type);
CREATE INDEX idx_navaids_iso_country ON navaids (iso_country);
";
app_state
.sqlite_connection
Expand Down

0 comments on commit 84608cc

Please sign in to comment.