Add unique ID per post and an index to the db for that

This commit is contained in:
“bobbydigitales”
2024-03-24 22:51:33 -07:00
parent b07a93246f
commit 49a2c8b011
4 changed files with 7 additions and 2 deletions

View File

@@ -36,6 +36,7 @@ export function openDatabase(userID:string): Promise<IDBDatabase> {
if (!db.objectStoreNames.contains(storeName)) {
let store = db.createObjectStore(storeName, { keyPath: "id", autoIncrement: true });
store.createIndex("datetimeIndex", "post_timestamp", { unique: false });
store.createIndex("postIDIndex", "data.post_id", { unique: true });
}
};