Skip to content

Commit 81720f2

Browse files
authored
Merge pull request #428 from samchon/prisma-v7
Bump up prisma v7, and lots of changes
2 parents e656a13 + f03ff2b commit 81720f2

15 files changed

Lines changed: 263 additions & 271 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ lib/
44
node_modules/
55
prisma/migrations
66
prisma/schema/migrations
7+
src/prisma
78

89
*.DS_Store
910
package-lock.json

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"nestia": "^9.0.3",
6868
"prettier": "^3.2.5",
6969
"prettier-plugin-prisma": "^5.0.0",
70-
"prisma-markdown": "^3.0.1",
70+
"prisma-markdown": "^4.0.0",
7171
"rimraf": "^3.0.2",
7272
"rollup": "^4.18.0",
7373
"sloc": "^0.2.1",
@@ -87,13 +87,14 @@
8787
"@nestjs/common": "^11.1.9",
8888
"@nestjs/core": "^11.1.9",
8989
"@nestjs/platform-express": "^11.1.9",
90-
"@prisma/adapter-pg": "^6.19.0",
91-
"@prisma/client": "^6.19.0",
90+
"@prisma/adapter-pg": "^7.0.0",
91+
"@prisma/client": "^7.0.0",
92+
"@prisma/internals": "^7.0.0",
9293
"dotenv": "^16.3.1",
9394
"dotenv-expand": "^10.0.0",
9495
"git-last-commit": "^1.0.0",
9596
"jsonwebtoken": "^9.0.2",
96-
"prisma": "^6.19.0",
97+
"prisma": "^7.0.0",
9798
"serialize-error": "^4.1.0",
9899
"source-map-support": "^0.5.19",
99100
"tgrid": "^1.2.0",

prisma.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import dotenv from "dotenv";
2+
import dotenvExpand from "dotenv-expand";
3+
import { defineConfig, env } from "prisma/config";
4+
5+
dotenvExpand.expand(dotenv.config());
6+
7+
export default defineConfig({
8+
schema: "prisma/schema",
9+
datasource: {
10+
url: env("POSTGRES_URL"),
11+
},
12+
});

prisma/schema/main.prisma

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
generator client {
2-
provider = "prisma-client-js"
3-
engineType = "client"
2+
provider = "prisma-client"
3+
output = "../../src/prisma"
44
previewFeatures = ["postgresqlExtensions", "views"]
55
}
66

77
datasource db {
88
provider = "postgresql"
9-
url = env("POSTGRES_URL")
109
extensions = [pg_trgm]
1110
}
1211

src/MyConfiguration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ExceptionManager } from "@nestia/core";
2-
import { Prisma } from "@prisma/client";
2+
import { Prisma } from "@prisma/sdk";
33
import path from "path";
44

55
import { MyGlobal } from "./MyGlobal";

src/MyGlobal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { PrismaPg } from "@prisma/adapter-pg";
2-
import { PrismaClient } from "@prisma/client";
2+
import { PrismaClient } from "@prisma/sdk";
33
import dotenv from "dotenv";
44
import dotenvExpand from "dotenv-expand";
55
import { Singleton } from "tstl";

src/executable/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { PrismaPg } from "@prisma/adapter-pg";
2-
import { PrismaClient } from "@prisma/client";
2+
import { PrismaClient } from "@prisma/sdk";
33

44
import { MyGlobal } from "../MyGlobal";
55
import { MySetupWizard } from "../setup/MySetupWizard";

src/providers/common/AttachmentFileProvider.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Prisma } from "@prisma/client";
1+
import { Prisma } from "@prisma/sdk";
22
import { v4 } from "uuid";
33

44
import { IAttachmentFile } from "@ORGANIZATION/PROJECT-api/lib/structures/common/IAttachmentFile";
@@ -15,15 +15,15 @@ export namespace AttachmentFileProvider {
1515
created_at: input.created_at.toISOString(),
1616
});
1717
export const select = () =>
18-
Prisma.validator<Prisma.attachment_filesFindManyArgs>()({});
18+
({}) satisfies Prisma.attachment_filesFindManyArgs;
1919
}
2020

2121
export const collect = (input: IAttachmentFile.IStore) =>
22-
Prisma.validator<Prisma.attachment_filesCreateInput>()({
22+
({
2323
id: v4(),
2424
name: input.name,
2525
extension: input.extension,
2626
url: input.url,
2727
created_at: new Date(),
28-
});
28+
}) satisfies Prisma.attachment_filesCreateInput;
2929
}

src/providers/common/BbsArticleCommentProvider.ts

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Prisma } from "@prisma/client";
1+
import { Prisma } from "@prisma/sdk";
22
import { v4 } from "uuid";
33

44
import { IBbsArticle } from "@ORGANIZATION/PROJECT-api/lib/structures/common/IBbsArticle";
@@ -22,11 +22,11 @@ export namespace BbsArticleCommentProvider {
2222
created_at: input.created_at.toISOString(),
2323
});
2424
export const select = () =>
25-
Prisma.validator<Prisma.bbs_article_commentsFindManyArgs>()({
25+
({
2626
include: {
2727
snapshots: BbsArticleCommentSnapshotProvider.json.select(),
2828
} as const,
29-
});
29+
}) satisfies Prisma.bbs_article_commentsFindManyArgs;
3030
}
3131

3232
export const paginate = (
@@ -46,29 +46,27 @@ export namespace BbsArticleCommentProvider {
4646
export const search = (
4747
input: IBbsArticleComment.IRequest.ISearch | undefined,
4848
) =>
49-
Prisma.validator<Prisma.bbs_article_commentsWhereInput["AND"]>()(
50-
input?.body?.length
51-
? [
52-
{
53-
snapshots: {
54-
some: {
55-
body: {
56-
contains: input.body,
57-
},
49+
(input?.body?.length
50+
? [
51+
{
52+
snapshots: {
53+
some: {
54+
body: {
55+
contains: input.body,
5856
},
5957
},
6058
},
61-
]
62-
: [],
63-
);
59+
},
60+
]
61+
: []) satisfies Prisma.bbs_article_commentsWhereInput["AND"];
6462

6563
export const orderBy = (
6664
_key: IBbsArticleComment.IRequest.SortableColumns,
6765
value: "asc" | "desc",
6866
) =>
69-
Prisma.validator<Prisma.bbs_article_commentsOrderByWithRelationInput>()({
67+
({
7068
created_at: value,
71-
});
69+
}) satisfies Prisma.bbs_article_commentsOrderByWithRelationInput;
7270

7371
export const collect =
7472
<
@@ -81,7 +79,7 @@ export namespace BbsArticleCommentProvider {
8179
(related: { article: Pick<IBbsArticle, "id"> }) =>
8280
(input: Input) => {
8381
const snapshot = snapshotFactory(input);
84-
return Prisma.validator<Prisma.bbs_article_commentsCreateInput>()({
82+
return {
8583
id: v4(),
8684
article: {
8785
connect: { id: related.article.id },
@@ -90,6 +88,6 @@ export namespace BbsArticleCommentProvider {
9088
create: [snapshot],
9189
},
9290
created_at: new Date(),
93-
});
91+
} satisfies Prisma.bbs_article_commentsCreateInput;
9492
};
9593
}

src/providers/common/BbsArticleCommentSnapshotProvider.ts

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Prisma } from "@prisma/client";
1+
import { Prisma } from "@prisma/sdk";
22
import { v4 } from "uuid";
33

44
import { IBbsArticleComment } from "@ORGANIZATION/PROJECT-api/lib/structures/common/IBbsArticleComment";
@@ -23,15 +23,15 @@ export namespace BbsArticleCommentSnapshotProvider {
2323
created_at: input.created_at.toISOString(),
2424
});
2525
export const select = () =>
26-
Prisma.validator<Prisma.bbs_article_comment_snapshotsFindManyArgs>()({
26+
({
2727
include: {
2828
to_files: {
2929
include: {
3030
file: AttachmentFileProvider.json.select(),
3131
},
3232
},
3333
} as const,
34-
});
34+
}) satisfies Prisma.bbs_article_comment_snapshotsFindManyArgs;
3535
}
3636

3737
export const store =
@@ -51,21 +51,19 @@ export namespace BbsArticleCommentSnapshotProvider {
5151
};
5252

5353
export const collect = (input: IBbsArticleComment.IStore) =>
54-
Prisma.validator<Prisma.bbs_article_comment_snapshotsCreateWithoutCommentInput>()(
55-
{
56-
id: v4(),
57-
format: input.format,
58-
body: input.body,
59-
created_at: new Date(),
60-
to_files: {
61-
create: input.files.map((file, i) => ({
62-
id: v4(),
63-
file: {
64-
create: AttachmentFileProvider.collect(file),
65-
},
66-
sequence: i,
67-
})),
68-
},
54+
({
55+
id: v4(),
56+
format: input.format,
57+
body: input.body,
58+
created_at: new Date(),
59+
to_files: {
60+
create: input.files.map((file, i) => ({
61+
id: v4(),
62+
file: {
63+
create: AttachmentFileProvider.collect(file),
64+
},
65+
sequence: i,
66+
})),
6967
},
70-
);
68+
}) satisfies Prisma.bbs_article_comment_snapshotsCreateWithoutCommentInput;
7169
}

0 commit comments

Comments
 (0)