Skip to content

Commit d2ea76e

Browse files
chore: update schema
1 parent 08ac265 commit d2ea76e

File tree

5 files changed

+31
-6
lines changed

5 files changed

+31
-6
lines changed

backend-go/graphql/schema/post.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ type GetPostResult {
88

99
type Post {
1010
id: ID!
11+
title: String!
1112
content: String
1213
published: Boolean!
13-
title: String!
1414
author: User
1515
}
1616

backend-go/graphql/schema/user.graphql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extend type Query {
1212

1313
type User {
1414
id: ID!
15-
email: String!
1615
name: String!
17-
posts: [Post]
16+
email: String!
17+
posts: [Post!]
1818
}

backend-go/scripts/db/dump.sql

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
-- CreateTable
2+
CREATE TABLE IF NOT EXISTS "User" (
3+
"id" TEXT NOT NULL,
4+
"name" TEXT NOT NULL,
5+
"email" TEXT NOT NULL,
6+
7+
PRIMARY KEY ("id")
8+
);
9+
10+
-- CreateTable
11+
CREATE TABLE IF NOT EXISTS "Post" (
12+
"id" TEXT NOT NULL,
13+
"title" TEXT NOT NULL,
14+
"content" TEXT,
15+
"published" BOOLEAN NOT NULL DEFAULT false,
16+
"authorId" TEXT,
17+
18+
PRIMARY KEY ("id")
19+
);
20+
21+
-- CreateIndex
22+
CREATE UNIQUE INDEX "User.email_unique" ON "User"("email");
23+
24+
-- AddForeignKey
25+
ALTER TABLE "Post" ADD FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
type Post {
22
id: ID!
3+
title: String!
34
content: String
45
published: Boolean!
5-
title: String!
66
author: User
77
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
type User {
22
id: ID!
3-
email: String!
43
name: String!
5-
posts: [Post]
4+
email: String!
5+
posts: [Post!]
66
}

0 commit comments

Comments
 (0)