Skip to content

Commit

Permalink
Speed up database queries
Browse files Browse the repository at this point in the history
  • Loading branch information
bubelov committed Oct 21, 2024
1 parent 5761ea4 commit 4acc2e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/src/androidMain/kotlin/db/Database.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class Database(path: String) {
execSQL(ConfQueries.CREATE_TABLE)
execSQL("PRAGMA user_version=1")
}

execSQL(ElementCommentQueries.CREATE_INDICES)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class ElementCommentQueries(private val conn: SQLiteConnection) {
updated_at TEXT NOT NULL
);
"""
const val CREATE_INDICES = """
CREATE INDEX IF NOT EXISTS element_comment_element_id ON element_comment(element_id);
"""
}

fun insertOrReplace(comments: List<ElementComment>) {
Expand Down

0 comments on commit 4acc2e1

Please sign in to comment.