🧑💻 Added more Prisma Examples
This commit is contained in:
parent
999612086b
commit
145a8b3e9c
2 changed files with 32 additions and 0 deletions
24
examples/createGuildCounter.ts
Normal file
24
examples/createGuildCounter.ts
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
const createGuildCounter = await prisma.guildCounter.upsert({
|
||||||
|
where: {
|
||||||
|
guildId_channelId: {
|
||||||
|
guildId: guild.id,
|
||||||
|
channelId: discordChannel.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
update: {},
|
||||||
|
create: {
|
||||||
|
channelId: discordChannel.id,
|
||||||
|
triggerWord,
|
||||||
|
count: startValue || 0,
|
||||||
|
guild: {
|
||||||
|
connectOrCreate: {
|
||||||
|
create: {
|
||||||
|
id: guild.id,
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
id: guild.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
8
examples/findUniqueChannelCounter.ts
Normal file
8
examples/findUniqueChannelCounter.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
const channelCounter = await prisma.guildCounter.findUnique({
|
||||||
|
where: {
|
||||||
|
guildId_channelId: {
|
||||||
|
guildId: guild.id,
|
||||||
|
channelId: discordChannel.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
Loading…
Add table
Reference in a new issue