Files
SoullessNecromancer/server/prisma/seed.ts
T
2026-07-16 17:37:25 +02:00

93 lines
1.8 KiB
TypeScript

import { PrismaClient, ItemSlot } from "@prisma/client";
const prisma = new PrismaClient();
const items = [
{
key: "bone_dagger",
name: "Bone Dagger",
description: "A crude blade carved from a fallen warrior.",
slot: ItemSlot.WEAPON,
strBonus: 2,
dexBonus: 1,
intBonus: 0,
hpBonus: 0,
rarity: "common",
},
{
key: "shadow_veil",
name: "Shadow Veil",
description: "Cloth woven from twilight itself.",
slot: ItemSlot.ARMOR,
strBonus: 0,
dexBonus: 2,
intBonus: 1,
hpBonus: 10,
rarity: "common",
},
{
key: "grimoire_fragment",
name: "Grimoire Fragment",
description: "Pages torn from a forbidden tome.",
slot: ItemSlot.ACCESSORY,
strBonus: 0,
dexBonus: 0,
intBonus: 3,
hpBonus: 0,
rarity: "uncommon",
},
{
key: "necrotic_blade",
name: "Necrotic Blade",
description: "Steel that drinks life force.",
slot: ItemSlot.WEAPON,
strBonus: 4,
dexBonus: 0,
intBonus: 2,
hpBonus: 0,
rarity: "rare",
},
{
key: "ossuary_plate",
name: "Ossuary Plate",
description: "Armor fashioned from countless bones.",
slot: ItemSlot.ARMOR,
strBonus: 2,
dexBonus: 0,
intBonus: 0,
hpBonus: 25,
rarity: "rare",
},
{
key: "soul_phial",
name: "Soul Phial",
description: "A vial of restless essence. Restores energy.",
slot: ItemSlot.CONSUMABLE,
strBonus: 0,
dexBonus: 0,
intBonus: 0,
hpBonus: 0,
rarity: "common",
},
];
async function main() {
for (const item of items) {
await prisma.item.upsert({
where: { key: item.key },
update: item,
create: item,
});
}
console.log(`Seeded ${items.length} items.`);
}
main()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});