Skip to content

Commit b559ecf

Browse files
authored
Merge pull request #13 from onozaty/8-multischema-support
Add multi-schema support(#8)
2 parents fc56f0f + 09d76c9 commit b559ecf

File tree

9 files changed

+470
-28
lines changed

9 files changed

+470
-28
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
generator client {
2+
provider = "prisma-client-js"
3+
previewFeatures = ["multiSchema"]
4+
}
5+
6+
datasource db {
7+
provider = "postgresql"
8+
url = env("DATABASE_URL")
9+
schemas = ["foo", "bar"]
10+
}
11+
12+
generator comments {
13+
provider = "node ./dist/generator.cjs"
14+
}
15+
16+
/// A registered user
17+
model User {
18+
id BigInt @id @map(name: "id") /// Primary key
19+
20+
username String @map(name: "username") /// Username used to login
21+
firstname String @map(name: "firstname") /// User's firstname
22+
lastname String @map(name: "lastname") /// User's lastname
23+
email String @unique @map(name: "email") /// Email address
24+
25+
@@map("registered_user")
26+
@@schema("foo")
27+
}

src/__snapshots__/generator.test.ts.snap

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,62 @@ COMMENT ON COLUMN "shops"."created_at" IS 'Created At';
256256
"
257257
`;
258258

259+
exports[`multi-schema > comments-latest.json 1`] = `
260+
"{
261+
"foo.registered_user": {
262+
"table": {
263+
"schema": "foo",
264+
"tableName": "registered_user",
265+
"comment": "A registered user"
266+
},
267+
"columns": [
268+
{
269+
"schema": "foo",
270+
"tableName": "registered_user",
271+
"columnName": "id",
272+
"comment": "Primary key"
273+
},
274+
{
275+
"schema": "foo",
276+
"tableName": "registered_user",
277+
"columnName": "username",
278+
"comment": "Username used to login"
279+
},
280+
{
281+
"schema": "foo",
282+
"tableName": "registered_user",
283+
"columnName": "firstname",
284+
"comment": "User's firstname"
285+
},
286+
{
287+
"schema": "foo",
288+
"tableName": "registered_user",
289+
"columnName": "lastname",
290+
"comment": "User's lastname"
291+
},
292+
{
293+
"schema": "foo",
294+
"tableName": "registered_user",
295+
"columnName": "email",
296+
"comment": "Email address"
297+
}
298+
]
299+
}
300+
}"
301+
`;
302+
303+
exports[`multi-schema > migration.sql 1`] = `
304+
"
305+
-- foo.registered_user comments
306+
COMMENT ON TABLE "foo"."registered_user" IS 'A registered user';
307+
COMMENT ON COLUMN "foo"."registered_user"."id" IS 'Primary key';
308+
COMMENT ON COLUMN "foo"."registered_user"."username" IS 'Username used to login';
309+
COMMENT ON COLUMN "foo"."registered_user"."firstname" IS 'User''s firstname';
310+
COMMENT ON COLUMN "foo"."registered_user"."lastname" IS 'User''s lastname';
311+
COMMENT ON COLUMN "foo"."registered_user"."email" IS 'Email address';
312+
"
313+
`;
314+
259315
exports[`target-column > comments-latest.json 1`] = `
260316
"{
261317
"customers": {

0 commit comments

Comments
 (0)