Skip to content

Commit

Permalink
chore: upgrade Prisma to v5
Browse files Browse the repository at this point in the history
  • Loading branch information
lynnntropy committed Mar 2, 2024
1 parent 73d85e3 commit 464882c
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 34 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build": "tsc"
},
"dependencies": {
"@prisma/client": "3",
"@prisma/client": "5",
"@sentry/node": "^7.2.0",
"@sentry/tracing": "^7.2.0",
"amaribot.js": "^2.1.0",
Expand All @@ -35,7 +35,7 @@
"@types/mime-types": "^2.1.0",
"@types/node": "^18",
"nodemon": "^3.1.0",
"prisma": "3",
"prisma": "5",
"ts-node": "^10.4.0",
"typescript": "^5.3.3"
}
Expand Down
13 changes: 5 additions & 8 deletions src/modules/QuotesModule.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { Prisma, Quote } from ".prisma/client";
import { PrismaClientKnownRequestError } from "@prisma/client/runtime";
import { Prisma, Quote } from "@prisma/client";
import client from "../client";
import prisma from "../prisma";
import { buildSerializableMessage } from "../utils/structures";
import * as mime from "mime-types";
import {
Snowflake,
GuildMember,
Message,
MessageReaction,
CommandInteraction,
ApplicationCommandOptionType,
Expand All @@ -19,7 +17,6 @@ import config from "../config";
import { Command, CommandSubCommand } from "../internal/command";
import { Module, SerializableMessage } from "../internal/types";
import { buildUsernameString } from "../utils/strings";
import { Channel } from "diagnostics_channel";

const PREVIOUS_REACTION_EMOJI = "⏮";
const NEXT_REACTION_EMOJI = "⏭";
Expand Down Expand Up @@ -88,7 +85,7 @@ class QuotesCommand extends Command {
});
} catch (e) {
if (
e instanceof PrismaClientKnownRequestError &&
e instanceof Prisma.PrismaClientKnownRequestError &&
e.code === "P2002"
) {
await interaction.reply("That message has already been quoted.");
Expand Down Expand Up @@ -202,7 +199,7 @@ class QuotesCommand extends Command {
return;
}

if (result.total_results === 1) {
if (result.total_results === BigInt(1)) {
await interaction.editReply({
embeds: [
await buildEmbedForQuotedMessage(
Expand Down Expand Up @@ -263,7 +260,7 @@ class QuotesCommand extends Command {
}

if (reaction.emoji.name === NEXT_REACTION_EMOJI) {
if (offset >= result.total_results - 1) return;
if (offset >= result.total_results - BigInt(1)) return;
offset++;
await renderCurrentQuote();
}
Expand Down Expand Up @@ -408,7 +405,7 @@ interface SearchInput {

interface SearchResult extends Quote {
rank: number;
total_results: number;
total_results: bigint;
}

const searchQuotes = async (input: SearchInput) => {
Expand Down
5 changes: 2 additions & 3 deletions src/modules/StickersModule.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { hyperlink } from "@discordjs/builders";
import { Sticker } from "@prisma/client";
import { PrismaClientKnownRequestError } from "@prisma/client/runtime";
import { Prisma, Sticker } from "@prisma/client";
import {
APIEmbed,
ApplicationCommandOptionType,
Expand Down Expand Up @@ -95,7 +94,7 @@ class StickersCommand extends Command {
});
} catch (e) {
if (
e instanceof PrismaClientKnownRequestError &&
e instanceof Prisma.PrismaClientKnownRequestError &&
e.code === "P2002"
) {
await interaction.reply({
Expand Down
66 changes: 45 additions & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -301,22 +301,46 @@
resolved "https://registry.yarnpkg.com/@panva/asn1.js/-/asn1.js-1.0.0.tgz#dd55ae7b8129e02049f009408b97c61ccf9032f6"
integrity sha512-UdkG3mLEqXgnlKsWanWcgb6dOjUzJ+XC5f+aWw30qrtjxeNUSfKX1cd5FBzOaXQumoe9nIqeZUvrRJS03HCCtw==

"@prisma/client@3":
version "3.15.2"
resolved "https://registry.yarnpkg.com/@prisma/client/-/client-3.15.2.tgz#2181398147afc79bfe0d83c03a88dc45b49bd365"
integrity sha512-ErqtwhX12ubPhU4d++30uFY/rPcyvjk+mdifaZO5SeM21zS3t4jQrscy8+6IyB0GIYshl5ldTq6JSBo1d63i8w==
dependencies:
"@prisma/engines-version" "3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e"

"@prisma/engines-version@3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e":
version "3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e"
resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e.tgz#bf5e2373ca68ce7556b967cb4965a7095e93fe53"
integrity sha512-e3k2Vd606efd1ZYy2NQKkT4C/pn31nehyLhVug6To/q8JT8FpiMrDy7zmm3KLF0L98NOQQcutaVtAPhzKhzn9w==

"@prisma/[email protected]":
version "3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e"
resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e.tgz#f691893df506b93e3cb1ccc15ec6e5ac64e8e570"
integrity sha512-NHlojO1DFTsSi3FtEleL9QWXeSF/UjhCW0fgpi7bumnNZ4wj/eQ+BJJ5n2pgoOliTOGv9nX2qXvmHap7rJMNmg==
"@prisma/client@5":
version "5.10.2"
resolved "https://registry.yarnpkg.com/@prisma/client/-/client-5.10.2.tgz#e087b40a4de8e3171eb9cbf0a873465cd2068e17"
integrity sha512-ef49hzB2yJZCvM5gFHMxSFL9KYrIP9udpT5rYo0CsHD4P9IKj473MbhU1gjKKftiwWBTIyrt9jukprzZXazyag==

"@prisma/[email protected]":
version "5.10.2"
resolved "https://registry.yarnpkg.com/@prisma/debug/-/debug-5.10.2.tgz#74be81d8969978f4d53c1b4e76d61f04bfbc3951"
integrity sha512-bkBOmH9dpEBbMKFJj8V+Zp8IZHIBjy3fSyhLhxj4FmKGb/UBSt9doyfA6k1UeUREsMJft7xgPYBbHSOYBr8XCA==

"@prisma/engines-version@5.10.0-34.5a9203d0590c951969e85a7d07215503f4672eb9":
version "5.10.0-34.5a9203d0590c951969e85a7d07215503f4672eb9"
resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-5.10.0-34.5a9203d0590c951969e85a7d07215503f4672eb9.tgz#1502335d4d72d2014cb25b8ad8a740a3a13400ea"
integrity sha512-uCy/++3Jx/O3ufM+qv2H1L4tOemTNqcP/gyEVOlZqTpBvYJUe0tWtW0y3o2Ueq04mll4aM5X3f6ugQftOSLdFQ==

"@prisma/[email protected]":
version "5.10.2"
resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-5.10.2.tgz#a4851d90f76ad6d22e783d5fd2e2e8c0640f1e81"
integrity sha512-HkSJvix6PW8YqEEt3zHfCYYJY69CXsNdhU+wna+4Y7EZ+AwzeupMnUThmvaDA7uqswiHkgm5/SZ6/4CStjaGmw==
dependencies:
"@prisma/debug" "5.10.2"
"@prisma/engines-version" "5.10.0-34.5a9203d0590c951969e85a7d07215503f4672eb9"
"@prisma/fetch-engine" "5.10.2"
"@prisma/get-platform" "5.10.2"

"@prisma/[email protected]":
version "5.10.2"
resolved "https://registry.yarnpkg.com/@prisma/fetch-engine/-/fetch-engine-5.10.2.tgz#a061f6727d395c7033b55f9c6e92f8741a70d5c5"
integrity sha512-dSmXcqSt6DpTmMaLQ9K8ZKzVAMH3qwGCmYEZr/uVnzVhxRJ1EbT/w2MMwIdBNq1zT69Rvh0h75WMIi0mrIw7Hg==
dependencies:
"@prisma/debug" "5.10.2"
"@prisma/engines-version" "5.10.0-34.5a9203d0590c951969e85a7d07215503f4672eb9"
"@prisma/get-platform" "5.10.2"

"@prisma/[email protected]":
version "5.10.2"
resolved "https://registry.yarnpkg.com/@prisma/get-platform/-/get-platform-5.10.2.tgz#7af97b1d82e5574a474e3fbf6eaf04f4156bc535"
integrity sha512-nqXP6vHiY2PIsebBAuDeWiUYg8h8mfjBckHh6Jezuwej0QJNnjDiOq30uesmg+JXxGk99nqyG3B7wpcOODzXvg==
dependencies:
"@prisma/debug" "5.10.2"

"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2":
version "1.1.2"
Expand Down Expand Up @@ -2189,12 +2213,12 @@ prepend-http@^2.0.0:
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897"
integrity sha512-ravE6m9Atw9Z/jjttRUZ+clIXogdghyZAuWJ3qEzjT+jI/dL1ifAqhZeC5VHzQp1MSt1+jxKkFNemj/iO7tVUA==

prisma@3:
version "3.15.2"
resolved "https://registry.yarnpkg.com/prisma/-/prisma-3.15.2.tgz#4ebe32fb284da3ac60c49fbc16c75e56ecf32067"
integrity sha512-nMNSMZvtwrvoEQ/mui8L/aiCLZRCj5t6L3yujKpcDhIPk7garp8tL4nMx2+oYsN0FWBacevJhazfXAbV1kfBzA==
prisma@5:
version "5.10.2"
resolved "https://registry.yarnpkg.com/prisma/-/prisma-5.10.2.tgz#aa63085c49dc74cdb5c3816e8dd1fb4d74a2aadd"
integrity sha512-hqb/JMz9/kymRE25pMWCxkdyhbnIWrq+h7S6WysJpdnCvhstbJSNP/S6mScEcqiB8Qv2F+0R3yG+osRaWqZacQ==
dependencies:
"@prisma/engines" "3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e"
"@prisma/engines" "5.10.2"

process-warning@^3.0.0:
version "3.0.0"
Expand Down

0 comments on commit 464882c

Please sign in to comment.