chore: add indexes for various models
All checks were successful
Build / build (18) (pull_request) Successful in 45s
Build / build (20) (pull_request) Successful in 1m4s
Build / build (20) (push) Successful in 43s
Build / build (18) (push) Successful in 1m7s
Build / build (22) (push) Successful in 1m7s
Build / build (22) (pull_request) Successful in 42s

These are looked up by the owner account id and/or assumed to exist only once per account.
No index was added for "Ships" as that does not match these critera.
This commit is contained in:
Sainan 2025-03-16 14:28:46 +01:00
parent c3a9b42fa2
commit 27427aba6d
5 changed files with 10 additions and 0 deletions

View File

@ -138,4 +138,6 @@ messageSchema.set("toJSON", {
}
});
messageSchema.index({ ownerId: 1 });
export const Inbox = model<IMessageDatabase>("Inbox", messageSchema, "inbox");

View File

@ -1443,6 +1443,8 @@ inventorySchema.set("toJSON", {
}
});
inventorySchema.index({ accountOwnerId: 1 }, { unique: true });
// type overwrites for subdocuments/subdocument arrays
export type InventoryDocumentProps = {
FlavourItems: Types.DocumentArray<IFlavourItem>;

View File

@ -78,6 +78,8 @@ loadoutSchema.set("toJSON", {
}
});
loadoutSchema.index({ loadoutOwnerId: 1 }, { unique: true });
//create database typefor ILoadoutConfig
type loadoutDocumentProps = {
NORMAL: Types.DocumentArray<ILoadoutConfigDatabase>;

View File

@ -152,6 +152,8 @@ export const personalRoomsSchema = new Schema<IPersonalRoomsDatabase>({
TailorShop: { type: tailorShopSchema, default: tailorShopDefault }
});
personalRoomsSchema.index({ personalRoomsOwnerId: 1 }, { unique: true });
export const PersonalRooms = model<IPersonalRoomsDatabase, PersonalRoomsModelType>(
"PersonalRooms",
personalRoomsSchema

View File

@ -103,6 +103,8 @@ statsSchema.set("toJSON", {
}
});
statsSchema.index({ accountOwnerId: 1 }, { unique: true });
export const Stats = model<IStatsDatabase>("Stats", statsSchema);
// eslint-disable-next-line @typescript-eslint/ban-types