diff --git a/examples/realworld/README.md b/examples/realworld/README.md index 4b7eaa7f4..17dca1381 100644 --- a/examples/realworld/README.md +++ b/examples/realworld/README.md @@ -19,6 +19,7 @@ Todo: - [x] Add tags to articles. - [x] Show Popular Tags on home page. - [x] Favorite articles. +- [ ] Make tags work again (Prisma problems!). - [ ] Following other users. - [ ] Paginated lists of articles (on profile page, on home page). - [ ] Use Bootstrap 4 styling. diff --git a/examples/realworld/ext/queries.js b/examples/realworld/ext/queries.js index c35a7b6c5..206432c3f 100644 --- a/examples/realworld/ext/queries.js +++ b/examples/realworld/ext/queries.js @@ -33,7 +33,7 @@ const articleInclude = { // It would be cool if we had some protection against making this mistake easily. select: userPublicSelection }, - //tags: true, // TODO: This causes prisma to explode, uncomment once I get it working. + tags: true, favoritedBy: { select: { // TODO: Tricky, if I forgot this select here, sensitive data could leak out (hashed password). @@ -57,7 +57,6 @@ const getArticles = async ({ where }, context) => { for (const article of articles) { articleSetFavoritedFields(article, context.user) - article.tags = [] // TODO: Remove this, it is just temporary fix until we fix problem with including tags. } return articles @@ -81,7 +80,6 @@ export const getArticle = async ({ slug }, context) => { include: articleInclude }) articleSetFavoritedFields(article, context.user) - article.tags = [] // TODO: Remove this, it is just temporary fix until we fix problem with including tags. return article } diff --git a/examples/realworld/migrations/20201030161549-user/README.md b/examples/realworld/migrations/20201030161549-user/README.md deleted file mode 100644 index 5a50f3b88..000000000 --- a/examples/realworld/migrations/20201030161549-user/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# Migration `20201030161549-user` - -This migration has been generated by Martin Sosic at 10/30/2020, 5:15:49 PM. -You can check out the [state of the schema](./schema.prisma) after the migration. - -## Database Steps - -```sql -CREATE TABLE "User" ( - "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "description" TEXT NOT NULL, - "isDone" BOOLEAN NOT NULL DEFAULT false -) -``` - -## Changes - -```diff -diff --git schema.prisma schema.prisma -migration ..20201030161549-user ---- datamodel.dml -+++ datamodel.dml -@@ -1,0 +1,17 @@ -+ -+datasource db { -+ provider = "sqlite" -+ url = "***" -+} -+ -+generator client { -+ provider = "prisma-client-js" -+ output = "../server/node_modules/.prisma/client" -+} -+ -+model User { -+ id Int @id @default(autoincrement()) -+ description String -+ isDone Boolean @default(false) -+} -+ -``` - - diff --git a/examples/realworld/migrations/20201030161549-user/schema.prisma b/examples/realworld/migrations/20201030161549-user/schema.prisma deleted file mode 100644 index 9ea97b3a7..000000000 --- a/examples/realworld/migrations/20201030161549-user/schema.prisma +++ /dev/null @@ -1,17 +0,0 @@ - -datasource db { - provider = "sqlite" - url = "***" -} - -generator client { - provider = "prisma-client-js" - output = "../server/node_modules/.prisma/client" -} - -model User { - id Int @id @default(autoincrement()) - description String - isDone Boolean @default(false) -} - diff --git a/examples/realworld/migrations/20201030161549-user/steps.json b/examples/realworld/migrations/20201030161549-user/steps.json deleted file mode 100644 index 4d6eeda81..000000000 --- a/examples/realworld/migrations/20201030161549-user/steps.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "version": "0.3.14-fixed", - "steps": [ - { - "tag": "CreateSource", - "source": "db" - }, - { - "tag": "CreateArgument", - "location": { - "tag": "Source", - "source": "db" - }, - "argument": "provider", - "value": "\"sqlite\"" - }, - { - "tag": "CreateArgument", - "location": { - "tag": "Source", - "source": "db" - }, - "argument": "url", - "value": "\"***\"" - }, - { - "tag": "CreateModel", - "model": "User" - }, - { - "tag": "CreateField", - "model": "User", - "field": "id", - "type": "Int", - "arity": "Required" - }, - { - "tag": "CreateDirective", - "location": { - "path": { - "tag": "Field", - "model": "User", - "field": "id" - }, - "directive": "id" - } - }, - { - "tag": "CreateDirective", - "location": { - "path": { - "tag": "Field", - "model": "User", - "field": "id" - }, - "directive": "default" - } - }, - { - "tag": "CreateArgument", - "location": { - "tag": "Directive", - "path": { - "tag": "Field", - "model": "User", - "field": "id" - }, - "directive": "default" - }, - "argument": "", - "value": "autoincrement()" - }, - { - "tag": "CreateField", - "model": "User", - "field": "description", - "type": "String", - "arity": "Required" - }, - { - "tag": "CreateField", - "model": "User", - "field": "isDone", - "type": "Boolean", - "arity": "Required" - }, - { - "tag": "CreateDirective", - "location": { - "path": { - "tag": "Field", - "model": "User", - "field": "isDone" - }, - "directive": "default" - } - }, - { - "tag": "CreateArgument", - "location": { - "tag": "Directive", - "path": { - "tag": "Field", - "model": "User", - "field": "isDone" - }, - "directive": "default" - }, - "argument": "", - "value": "false" - } - ] -} \ No newline at end of file diff --git a/examples/realworld/migrations/20201030185724-fixed-user/README.md b/examples/realworld/migrations/20201030185724-fixed-user/README.md deleted file mode 100644 index 519015b89..000000000 --- a/examples/realworld/migrations/20201030185724-fixed-user/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# Migration `20201030185724-fixed-user` - -This migration has been generated by Martin Sosic at 10/30/2020, 7:57:24 PM. -You can check out the [state of the schema](./schema.prisma) after the migration. - -## Database Steps - -```sql -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_User" ( - "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "username" TEXT NOT NULL, - "email" TEXT NOT NULL, - "password" TEXT NOT NULL -); -INSERT INTO "new_User" ("id") SELECT "id" FROM "User"; -DROP TABLE "User"; -ALTER TABLE "new_User" RENAME TO "User"; -CREATE UNIQUE INDEX "User.username_unique" ON "User"("username"); -CREATE UNIQUE INDEX "User.email_unique" ON "User"("email"); -PRAGMA foreign_key_check; -PRAGMA foreign_keys=ON -``` - -## Changes - -```diff -diff --git schema.prisma schema.prisma -migration 20201030161549-user..20201030185724-fixed-user ---- datamodel.dml -+++ datamodel.dml -@@ -1,8 +1,8 @@ - datasource db { - provider = "sqlite" -- url = "***" -+ url = "***" - } - generator client { - provider = "prisma-client-js" -@@ -10,8 +10,9 @@ - } - model User { - id Int @id @default(autoincrement()) -- description String -- isDone Boolean @default(false) -+ username String @unique -+ email String @unique -+ password String - } -``` - - diff --git a/examples/realworld/migrations/20201030185724-fixed-user/schema.prisma b/examples/realworld/migrations/20201030185724-fixed-user/schema.prisma deleted file mode 100644 index f2d2b78c0..000000000 --- a/examples/realworld/migrations/20201030185724-fixed-user/schema.prisma +++ /dev/null @@ -1,18 +0,0 @@ - -datasource db { - provider = "sqlite" - url = "***" -} - -generator client { - provider = "prisma-client-js" - output = "../server/node_modules/.prisma/client" -} - -model User { - id Int @id @default(autoincrement()) - username String @unique - email String @unique - password String -} - diff --git a/examples/realworld/migrations/20201030185724-fixed-user/steps.json b/examples/realworld/migrations/20201030185724-fixed-user/steps.json deleted file mode 100644 index 36ce35d0e..000000000 --- a/examples/realworld/migrations/20201030185724-fixed-user/steps.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "version": "0.3.14-fixed", - "steps": [ - { - "tag": "CreateField", - "model": "User", - "field": "username", - "type": "String", - "arity": "Required" - }, - { - "tag": "CreateDirective", - "location": { - "path": { - "tag": "Field", - "model": "User", - "field": "username" - }, - "directive": "unique" - } - }, - { - "tag": "CreateField", - "model": "User", - "field": "email", - "type": "String", - "arity": "Required" - }, - { - "tag": "CreateDirective", - "location": { - "path": { - "tag": "Field", - "model": "User", - "field": "email" - }, - "directive": "unique" - } - }, - { - "tag": "CreateField", - "model": "User", - "field": "password", - "type": "String", - "arity": "Required" - }, - { - "tag": "DeleteField", - "model": "User", - "field": "description" - }, - { - "tag": "DeleteField", - "model": "User", - "field": "isDone" - } - ] -} \ No newline at end of file diff --git a/examples/realworld/migrations/20201117145436-added-bio-and-picture-to-user/README.md b/examples/realworld/migrations/20201117145436-added-bio-and-picture-to-user/README.md deleted file mode 100644 index ee696a6c0..000000000 --- a/examples/realworld/migrations/20201117145436-added-bio-and-picture-to-user/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# Migration `20201117145436-added-bio-and-picture-to-user` - -This migration has been generated by Martin Sosic at 11/17/2020, 3:54:36 PM. -You can check out the [state of the schema](./schema.prisma) after the migration. - -## Database Steps - -```sql -ALTER TABLE "User" ADD COLUMN "bio" TEXT; -ALTER TABLE "User" ADD COLUMN "profilePictureUrl" TEXT -``` - -## Changes - -```diff -diff --git schema.prisma schema.prisma -migration 20201030185724-fixed-user..20201117145436-added-bio-and-picture-to-user ---- datamodel.dml -+++ datamodel.dml -@@ -1,8 +1,8 @@ - datasource db { - provider = "sqlite" -- url = "***" -+ url = "***" - } - generator client { - provider = "prisma-client-js" -@@ -13,6 +13,8 @@ - id Int @id @default(autoincrement()) - username String @unique - email String @unique - password String -+ bio String? -+ profilePictureUrl String? - } -``` - - diff --git a/examples/realworld/migrations/20201117145436-added-bio-and-picture-to-user/schema.prisma b/examples/realworld/migrations/20201117145436-added-bio-and-picture-to-user/schema.prisma deleted file mode 100644 index 2deb025fc..000000000 --- a/examples/realworld/migrations/20201117145436-added-bio-and-picture-to-user/schema.prisma +++ /dev/null @@ -1,20 +0,0 @@ - -datasource db { - provider = "sqlite" - url = "***" -} - -generator client { - provider = "prisma-client-js" - output = "../server/node_modules/.prisma/client" -} - -model User { - id Int @id @default(autoincrement()) - username String @unique - email String @unique - password String - bio String? - profilePictureUrl String? -} - diff --git a/examples/realworld/migrations/20201117145436-added-bio-and-picture-to-user/steps.json b/examples/realworld/migrations/20201117145436-added-bio-and-picture-to-user/steps.json deleted file mode 100644 index 1ff4f8844..000000000 --- a/examples/realworld/migrations/20201117145436-added-bio-and-picture-to-user/steps.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "0.3.14-fixed", - "steps": [ - { - "tag": "CreateField", - "model": "User", - "field": "bio", - "type": "String", - "arity": "Optional" - }, - { - "tag": "CreateField", - "model": "User", - "field": "profilePictureUrl", - "type": "String", - "arity": "Optional" - } - ] -} \ No newline at end of file diff --git a/examples/realworld/migrations/20201119144622-added-article-entity/README.md b/examples/realworld/migrations/20201119144622-added-article-entity/README.md deleted file mode 100644 index 25acb58a0..000000000 --- a/examples/realworld/migrations/20201119144622-added-article-entity/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# Migration `20201119144622-added-article-entity` - -This migration has been generated by Martin Sosic at 11/19/2020, 3:46:22 PM. -You can check out the [state of the schema](./schema.prisma) after the migration. - -## Database Steps - -```sql -CREATE TABLE "Article" ( - "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "title" TEXT NOT NULL, - "description" TEXT NOT NULL, - "markdownContent" TEXT NOT NULL, - "userId" INTEGER NOT NULL, - - FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE -) -``` - -## Changes - -```diff -diff --git schema.prisma schema.prisma -migration 20201117145436-added-bio-and-picture-to-user..20201119144622-added-article-entity ---- datamodel.dml -+++ datamodel.dml -@@ -1,8 +1,8 @@ - datasource db { - provider = "sqlite" -- url = "***" -+ url = "***" - } - generator client { - provider = "prisma-client-js" -@@ -15,6 +15,16 @@ - email String @unique - password String - bio String? - profilePictureUrl String? -+ articles Article[] - } -+model Article { -+ id Int @id @default(autoincrement()) -+ title String -+ description String -+ markdownContent String -+ user User @relation(fields: [userId], references: [id]) -+ userId Int -+} -+ -``` - - diff --git a/examples/realworld/migrations/20201119144622-added-article-entity/schema.prisma b/examples/realworld/migrations/20201119144622-added-article-entity/schema.prisma deleted file mode 100644 index 2cda44f45..000000000 --- a/examples/realworld/migrations/20201119144622-added-article-entity/schema.prisma +++ /dev/null @@ -1,30 +0,0 @@ - -datasource db { - provider = "sqlite" - url = "***" -} - -generator client { - provider = "prisma-client-js" - output = "../server/node_modules/.prisma/client" -} - -model User { - id Int @id @default(autoincrement()) - username String @unique - email String @unique - password String - bio String? - profilePictureUrl String? - articles Article[] -} - -model Article { - id Int @id @default(autoincrement()) - title String - description String - markdownContent String - user User @relation(fields: [userId], references: [id]) - userId Int -} - diff --git a/examples/realworld/migrations/20201119144622-added-article-entity/steps.json b/examples/realworld/migrations/20201119144622-added-article-entity/steps.json deleted file mode 100644 index 848115883..000000000 --- a/examples/realworld/migrations/20201119144622-added-article-entity/steps.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "version": "0.3.14-fixed", - "steps": [ - { - "tag": "CreateModel", - "model": "Article" - }, - { - "tag": "CreateField", - "model": "Article", - "field": "id", - "type": "Int", - "arity": "Required" - }, - { - "tag": "CreateDirective", - "location": { - "path": { - "tag": "Field", - "model": "Article", - "field": "id" - }, - "directive": "id" - } - }, - { - "tag": "CreateDirective", - "location": { - "path": { - "tag": "Field", - "model": "Article", - "field": "id" - }, - "directive": "default" - } - }, - { - "tag": "CreateArgument", - "location": { - "tag": "Directive", - "path": { - "tag": "Field", - "model": "Article", - "field": "id" - }, - "directive": "default" - }, - "argument": "", - "value": "autoincrement()" - }, - { - "tag": "CreateField", - "model": "Article", - "field": "title", - "type": "String", - "arity": "Required" - }, - { - "tag": "CreateField", - "model": "Article", - "field": "description", - "type": "String", - "arity": "Required" - }, - { - "tag": "CreateField", - "model": "Article", - "field": "markdownContent", - "type": "String", - "arity": "Required" - }, - { - "tag": "CreateField", - "model": "Article", - "field": "user", - "type": "User", - "arity": "Required" - }, - { - "tag": "CreateDirective", - "location": { - "path": { - "tag": "Field", - "model": "Article", - "field": "user" - }, - "directive": "relation" - } - }, - { - "tag": "CreateArgument", - "location": { - "tag": "Directive", - "path": { - "tag": "Field", - "model": "Article", - "field": "user" - }, - "directive": "relation" - }, - "argument": "fields", - "value": "[userId]" - }, - { - "tag": "CreateArgument", - "location": { - "tag": "Directive", - "path": { - "tag": "Field", - "model": "Article", - "field": "user" - }, - "directive": "relation" - }, - "argument": "references", - "value": "[id]" - }, - { - "tag": "CreateField", - "model": "Article", - "field": "userId", - "type": "Int", - "arity": "Required" - }, - { - "tag": "CreateField", - "model": "User", - "field": "articles", - "type": "Article", - "arity": "List" - } - ] -} \ No newline at end of file diff --git a/examples/realworld/migrations/20201124192901-added-created-at-to-article/README.md b/examples/realworld/migrations/20201124192901-added-created-at-to-article/README.md deleted file mode 100644 index d29fde4f2..000000000 --- a/examples/realworld/migrations/20201124192901-added-created-at-to-article/README.md +++ /dev/null @@ -1,62 +0,0 @@ -# Migration `20201124192901-added-created-at-to-article` - -This migration has been generated by Martin Sosic at 11/24/2020, 8:29:01 PM. -You can check out the [state of the schema](./schema.prisma) after the migration. - -## Database Steps - -```sql -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Article" ( - "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - "title" TEXT NOT NULL, - "description" TEXT NOT NULL, - "markdownContent" TEXT NOT NULL, - "userId" INTEGER NOT NULL, - - FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE -); -INSERT INTO "new_Article" ("id", "title", "description", "markdownContent", "userId") SELECT "id", "title", "description", "markdownContent", "userId" FROM "Article"; -DROP TABLE "Article"; -ALTER TABLE "new_Article" RENAME TO "Article"; -PRAGMA foreign_key_check; -PRAGMA foreign_keys=ON -``` - -## Changes - -```diff -diff --git schema.prisma schema.prisma -migration 20201119144622-added-article-entity..20201124192901-added-created-at-to-article ---- datamodel.dml -+++ datamodel.dml -@@ -1,8 +1,8 @@ - datasource db { - provider = "sqlite" -- url = "***" -+ url = "***" - } - generator client { - provider = "prisma-client-js" -@@ -19,12 +19,13 @@ - articles Article[] - } - model Article { -- id Int @id @default(autoincrement()) -- title String -- description String -- markdownContent String -- user User @relation(fields: [userId], references: [id]) -- userId Int -+ id Int @id @default(autoincrement()) -+ createdAt DateTime @default(now()) -+ title String -+ description String -+ markdownContent String -+ user User @relation(fields: [userId], references: [id]) -+ userId Int - } -``` - - diff --git a/examples/realworld/migrations/20201124192901-added-created-at-to-article/schema.prisma b/examples/realworld/migrations/20201124192901-added-created-at-to-article/schema.prisma deleted file mode 100644 index 871307c5a..000000000 --- a/examples/realworld/migrations/20201124192901-added-created-at-to-article/schema.prisma +++ /dev/null @@ -1,31 +0,0 @@ - -datasource db { - provider = "sqlite" - url = "***" -} - -generator client { - provider = "prisma-client-js" - output = "../server/node_modules/.prisma/client" -} - -model User { - id Int @id @default(autoincrement()) - username String @unique - email String @unique - password String - bio String? - profilePictureUrl String? - articles Article[] -} - -model Article { - id Int @id @default(autoincrement()) - createdAt DateTime @default(now()) - title String - description String - markdownContent String - user User @relation(fields: [userId], references: [id]) - userId Int -} - diff --git a/examples/realworld/migrations/20201124192901-added-created-at-to-article/steps.json b/examples/realworld/migrations/20201124192901-added-created-at-to-article/steps.json deleted file mode 100644 index 63b04ea99..000000000 --- a/examples/realworld/migrations/20201124192901-added-created-at-to-article/steps.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "version": "0.3.14-fixed", - "steps": [ - { - "tag": "CreateField", - "model": "Article", - "field": "createdAt", - "type": "DateTime", - "arity": "Required" - }, - { - "tag": "CreateDirective", - "location": { - "path": { - "tag": "Field", - "model": "Article", - "field": "createdAt" - }, - "directive": "default" - } - }, - { - "tag": "CreateArgument", - "location": { - "tag": "Directive", - "path": { - "tag": "Field", - "model": "Article", - "field": "createdAt" - }, - "directive": "default" - }, - "argument": "", - "value": "now()" - } - ] -} \ No newline at end of file diff --git a/examples/realworld/migrations/20201124195623-added-slug-to-article/README.md b/examples/realworld/migrations/20201124195623-added-slug-to-article/README.md deleted file mode 100644 index 951e5a5e1..000000000 --- a/examples/realworld/migrations/20201124195623-added-slug-to-article/README.md +++ /dev/null @@ -1,66 +0,0 @@ -# Migration `20201124195623-added-slug-to-article` - -This migration has been generated by Martin Sosic at 11/24/2020, 8:56:23 PM. -You can check out the [state of the schema](./schema.prisma) after the migration. - -## Database Steps - -```sql -CREATE TABLE "User" ( - "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "username" TEXT NOT NULL, - "email" TEXT NOT NULL, - "password" TEXT NOT NULL, - "bio" TEXT, - "profilePictureUrl" TEXT -) - -CREATE TABLE "Article" ( - "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "slug" TEXT NOT NULL, - "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" DATETIME NOT NULL, - "title" TEXT NOT NULL, - "description" TEXT NOT NULL, - "markdownContent" TEXT NOT NULL, - "userId" INTEGER NOT NULL, - - FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE -) - -CREATE UNIQUE INDEX "User.username_unique" ON "User"("username") - -CREATE UNIQUE INDEX "User.email_unique" ON "User"("email") - -CREATE UNIQUE INDEX "Article.slug_unique" ON "Article"("slug") -``` - -## Changes - -```diff -diff --git schema.prisma schema.prisma -migration 20201124192901-added-created-at-to-article..20201124195623-added-slug-to-article ---- datamodel.dml -+++ datamodel.dml -@@ -1,8 +1,8 @@ - datasource db { - provider = "sqlite" -- url = "***" -+ url = "***" - } - generator client { - provider = "prisma-client-js" -@@ -20,9 +20,11 @@ - } - model Article { - id Int @id @default(autoincrement()) -+ slug String @unique - createdAt DateTime @default(now()) -+ updatedAt DateTime @updatedAt - title String - description String - markdownContent String - user User @relation(fields: [userId], references: [id]) -``` - - diff --git a/examples/realworld/migrations/20201124195623-added-slug-to-article/schema.prisma b/examples/realworld/migrations/20201124195623-added-slug-to-article/schema.prisma deleted file mode 100644 index 46fc3bad7..000000000 --- a/examples/realworld/migrations/20201124195623-added-slug-to-article/schema.prisma +++ /dev/null @@ -1,33 +0,0 @@ - -datasource db { - provider = "sqlite" - url = "***" -} - -generator client { - provider = "prisma-client-js" - output = "../server/node_modules/.prisma/client" -} - -model User { - id Int @id @default(autoincrement()) - username String @unique - email String @unique - password String - bio String? - profilePictureUrl String? - articles Article[] -} - -model Article { - id Int @id @default(autoincrement()) - slug String @unique - createdAt DateTime @default(now()) - updatedAt DateTime @updatedAt - title String - description String - markdownContent String - user User @relation(fields: [userId], references: [id]) - userId Int -} - diff --git a/examples/realworld/migrations/20201124195623-added-slug-to-article/steps.json b/examples/realworld/migrations/20201124195623-added-slug-to-article/steps.json deleted file mode 100644 index d1d8c31f3..000000000 --- a/examples/realworld/migrations/20201124195623-added-slug-to-article/steps.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "version": "0.3.14-fixed", - "steps": [ - { - "tag": "CreateField", - "model": "Article", - "field": "slug", - "type": "String", - "arity": "Required" - }, - { - "tag": "CreateDirective", - "location": { - "path": { - "tag": "Field", - "model": "Article", - "field": "slug" - }, - "directive": "unique" - } - }, - { - "tag": "CreateField", - "model": "Article", - "field": "updatedAt", - "type": "DateTime", - "arity": "Required" - }, - { - "tag": "CreateDirective", - "location": { - "path": { - "tag": "Field", - "model": "Article", - "field": "updatedAt" - }, - "directive": "updatedAt" - } - } - ] -} \ No newline at end of file diff --git a/examples/realworld/migrations/20201124212222-added-comment/README.md b/examples/realworld/migrations/20201124212222-added-comment/README.md deleted file mode 100644 index 63b205935..000000000 --- a/examples/realworld/migrations/20201124212222-added-comment/README.md +++ /dev/null @@ -1,85 +0,0 @@ -# Migration `20201124212222-added-comment` - -This migration has been generated by Martin Sosic at 11/24/2020, 10:22:22 PM. -You can check out the [state of the schema](./schema.prisma) after the migration. - -## Database Steps - -```sql -CREATE TABLE "Comment" ( - "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - "content" TEXT NOT NULL, - "userId" INTEGER NOT NULL, - "articleId" INTEGER NOT NULL, - - FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE, - FOREIGN KEY ("articleId") REFERENCES "Article"("id") ON DELETE CASCADE ON UPDATE CASCADE -) -``` - -## Changes - -```diff -diff --git schema.prisma schema.prisma -migration 20201124195623-added-slug-to-article..20201124212222-added-comment ---- datamodel.dml -+++ datamodel.dml -@@ -1,33 +1,52 @@ - datasource db { - provider = "sqlite" -- url = "***" -+ url = "***" - } - generator client { - provider = "prisma-client-js" - output = "../server/node_modules/.prisma/client" - } - model User { -- id Int @id @default(autoincrement()) -- username String @unique -- email String @unique -- password String -- bio String? -+ id Int @id @default(autoincrement()) -+ username String @unique -+ email String @unique -+ password String -+ bio String? - profilePictureUrl String? -- articles Article[] -+ -+ articles Article[] -+ comments Comment[] - } - model Article { - id Int @id @default(autoincrement()) - slug String @unique - createdAt DateTime @default(now()) - updatedAt DateTime @updatedAt -+ - title String - description String - markdownContent String -+ - user User @relation(fields: [userId], references: [id]) - userId Int -+ -+ comments Comment[] - } -+model Comment { -+ id Int @id @default(autoincrement()) -+ createdAt DateTime @default(now()) -+ -+ content String -+ -+ user User @relation(fields: [userId], references: [id]) -+ userId Int -+ -+ article Article @relation(fields: [articleId], references: [id]) -+ articleId Int -+} -+ -``` - - diff --git a/examples/realworld/migrations/20201124212222-added-comment/schema.prisma b/examples/realworld/migrations/20201124212222-added-comment/schema.prisma deleted file mode 100644 index 6d2d000a1..000000000 --- a/examples/realworld/migrations/20201124212222-added-comment/schema.prisma +++ /dev/null @@ -1,52 +0,0 @@ - -datasource db { - provider = "sqlite" - url = "***" -} - -generator client { - provider = "prisma-client-js" - output = "../server/node_modules/.prisma/client" -} - -model User { - id Int @id @default(autoincrement()) - username String @unique - email String @unique - password String - bio String? - profilePictureUrl String? - - articles Article[] - comments Comment[] -} - -model Article { - id Int @id @default(autoincrement()) - slug String @unique - createdAt DateTime @default(now()) - updatedAt DateTime @updatedAt - - title String - description String - markdownContent String - - user User @relation(fields: [userId], references: [id]) - userId Int - - comments Comment[] -} - -model Comment { - id Int @id @default(autoincrement()) - createdAt DateTime @default(now()) - - content String - - user User @relation(fields: [userId], references: [id]) - userId Int - - article Article @relation(fields: [articleId], references: [id]) - articleId Int -} - diff --git a/examples/realworld/migrations/20201124212222-added-comment/steps.json b/examples/realworld/migrations/20201124212222-added-comment/steps.json deleted file mode 100644 index fbe835cfd..000000000 --- a/examples/realworld/migrations/20201124212222-added-comment/steps.json +++ /dev/null @@ -1,211 +0,0 @@ -{ - "version": "0.3.14-fixed", - "steps": [ - { - "tag": "CreateModel", - "model": "Comment" - }, - { - "tag": "CreateField", - "model": "Comment", - "field": "id", - "type": "Int", - "arity": "Required" - }, - { - "tag": "CreateDirective", - "location": { - "path": { - "tag": "Field", - "model": "Comment", - "field": "id" - }, - "directive": "id" - } - }, - { - "tag": "CreateDirective", - "location": { - "path": { - "tag": "Field", - "model": "Comment", - "field": "id" - }, - "directive": "default" - } - }, - { - "tag": "CreateArgument", - "location": { - "tag": "Directive", - "path": { - "tag": "Field", - "model": "Comment", - "field": "id" - }, - "directive": "default" - }, - "argument": "", - "value": "autoincrement()" - }, - { - "tag": "CreateField", - "model": "Comment", - "field": "createdAt", - "type": "DateTime", - "arity": "Required" - }, - { - "tag": "CreateDirective", - "location": { - "path": { - "tag": "Field", - "model": "Comment", - "field": "createdAt" - }, - "directive": "default" - } - }, - { - "tag": "CreateArgument", - "location": { - "tag": "Directive", - "path": { - "tag": "Field", - "model": "Comment", - "field": "createdAt" - }, - "directive": "default" - }, - "argument": "", - "value": "now()" - }, - { - "tag": "CreateField", - "model": "Comment", - "field": "content", - "type": "String", - "arity": "Required" - }, - { - "tag": "CreateField", - "model": "Comment", - "field": "user", - "type": "User", - "arity": "Required" - }, - { - "tag": "CreateDirective", - "location": { - "path": { - "tag": "Field", - "model": "Comment", - "field": "user" - }, - "directive": "relation" - } - }, - { - "tag": "CreateArgument", - "location": { - "tag": "Directive", - "path": { - "tag": "Field", - "model": "Comment", - "field": "user" - }, - "directive": "relation" - }, - "argument": "fields", - "value": "[userId]" - }, - { - "tag": "CreateArgument", - "location": { - "tag": "Directive", - "path": { - "tag": "Field", - "model": "Comment", - "field": "user" - }, - "directive": "relation" - }, - "argument": "references", - "value": "[id]" - }, - { - "tag": "CreateField", - "model": "Comment", - "field": "userId", - "type": "Int", - "arity": "Required" - }, - { - "tag": "CreateField", - "model": "Comment", - "field": "article", - "type": "Article", - "arity": "Required" - }, - { - "tag": "CreateDirective", - "location": { - "path": { - "tag": "Field", - "model": "Comment", - "field": "article" - }, - "directive": "relation" - } - }, - { - "tag": "CreateArgument", - "location": { - "tag": "Directive", - "path": { - "tag": "Field", - "model": "Comment", - "field": "article" - }, - "directive": "relation" - }, - "argument": "fields", - "value": "[articleId]" - }, - { - "tag": "CreateArgument", - "location": { - "tag": "Directive", - "path": { - "tag": "Field", - "model": "Comment", - "field": "article" - }, - "directive": "relation" - }, - "argument": "references", - "value": "[id]" - }, - { - "tag": "CreateField", - "model": "Comment", - "field": "articleId", - "type": "Int", - "arity": "Required" - }, - { - "tag": "CreateField", - "model": "User", - "field": "comments", - "type": "Comment", - "arity": "List" - }, - { - "tag": "CreateField", - "model": "Article", - "field": "comments", - "type": "Comment", - "arity": "List" - } - ] -} \ No newline at end of file diff --git a/examples/realworld/migrations/20201125134317-added-article-tag/README.md b/examples/realworld/migrations/20201125134317-added-article-tag/README.md deleted file mode 100644 index db6783bf6..000000000 --- a/examples/realworld/migrations/20201125134317-added-article-tag/README.md +++ /dev/null @@ -1,76 +0,0 @@ -# Migration `20201125134317-added-article-tag` - -This migration has been generated by Martin Sosic at 11/25/2020, 2:43:17 PM. -You can check out the [state of the schema](./schema.prisma) after the migration. - -## Database Steps - -```sql -CREATE TABLE "ArticleTag" ( - "name" TEXT NOT NULL, - PRIMARY KEY ("name") -) - -CREATE TABLE "_ArticleToArticleTag" ( - "A" INTEGER NOT NULL, - "B" TEXT NOT NULL, - - FOREIGN KEY ("A") REFERENCES "Article"("id") ON DELETE CASCADE ON UPDATE CASCADE, - FOREIGN KEY ("B") REFERENCES "ArticleTag"("name") ON DELETE CASCADE ON UPDATE CASCADE -) - -CREATE UNIQUE INDEX "_ArticleToArticleTag_AB_unique" ON "_ArticleToArticleTag"("A", "B") - -CREATE INDEX "_ArticleToArticleTag_B_index" ON "_ArticleToArticleTag"("B") -``` - -## Changes - -```diff -diff --git schema.prisma schema.prisma -migration 20201124212222-added-comment..20201125134317-added-article-tag ---- datamodel.dml -+++ datamodel.dml -@@ -1,8 +1,8 @@ - datasource db { - provider = "sqlite" -- url = "***" -+ url = "***" - } - generator client { - provider = "prisma-client-js" -@@ -25,28 +25,31 @@ - id Int @id @default(autoincrement()) - slug String @unique - createdAt DateTime @default(now()) - updatedAt DateTime @updatedAt -- - title String - description String - markdownContent String - user User @relation(fields: [userId], references: [id]) - userId Int -- - comments Comment[] -+ tags ArticleTag[] - } - model Comment { - id Int @id @default(autoincrement()) - createdAt DateTime @default(now()) -- - content String - user User @relation(fields: [userId], references: [id]) - userId Int -- - article Article @relation(fields: [articleId], references: [id]) - articleId Int - } -+model ArticleTag { -+ name String @id -+ -+ articles Article[] -+} -+ -``` - - diff --git a/examples/realworld/migrations/20201125134317-added-article-tag/schema.prisma b/examples/realworld/migrations/20201125134317-added-article-tag/schema.prisma deleted file mode 100644 index 8be90739b..000000000 --- a/examples/realworld/migrations/20201125134317-added-article-tag/schema.prisma +++ /dev/null @@ -1,55 +0,0 @@ - -datasource db { - provider = "sqlite" - url = "***" -} - -generator client { - provider = "prisma-client-js" - output = "../server/node_modules/.prisma/client" -} - -model User { - id Int @id @default(autoincrement()) - username String @unique - email String @unique - password String - bio String? - profilePictureUrl String? - - articles Article[] - comments Comment[] -} - -model Article { - id Int @id @default(autoincrement()) - slug String @unique - createdAt DateTime @default(now()) - updatedAt DateTime @updatedAt - title String - description String - markdownContent String - - user User @relation(fields: [userId], references: [id]) - userId Int - comments Comment[] - tags ArticleTag[] -} - -model Comment { - id Int @id @default(autoincrement()) - createdAt DateTime @default(now()) - content String - - user User @relation(fields: [userId], references: [id]) - userId Int - article Article @relation(fields: [articleId], references: [id]) - articleId Int -} - -model ArticleTag { - name String @id - - articles Article[] -} - diff --git a/examples/realworld/migrations/20201125134317-added-article-tag/steps.json b/examples/realworld/migrations/20201125134317-added-article-tag/steps.json deleted file mode 100644 index 7be85b480..000000000 --- a/examples/realworld/migrations/20201125134317-added-article-tag/steps.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "version": "0.3.14-fixed", - "steps": [ - { - "tag": "CreateModel", - "model": "ArticleTag" - }, - { - "tag": "CreateField", - "model": "ArticleTag", - "field": "name", - "type": "String", - "arity": "Required" - }, - { - "tag": "CreateDirective", - "location": { - "path": { - "tag": "Field", - "model": "ArticleTag", - "field": "name" - }, - "directive": "id" - } - }, - { - "tag": "CreateField", - "model": "ArticleTag", - "field": "articles", - "type": "Article", - "arity": "List" - }, - { - "tag": "CreateField", - "model": "Article", - "field": "tags", - "type": "ArticleTag", - "arity": "List" - } - ] -} \ No newline at end of file diff --git a/examples/realworld/migrations/20201126162628-added-favorite-articles/README.md b/examples/realworld/migrations/20201126162628-added-favorite-articles/README.md deleted file mode 100644 index f13a8b2ca..000000000 --- a/examples/realworld/migrations/20201126162628-added-favorite-articles/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# Migration `20201126162628-added-favorite-articles` - -This migration has been generated by Martin Sosic at 11/26/2020, 5:26:28 PM. -You can check out the [state of the schema](./schema.prisma) after the migration. - -## Database Steps - -```sql -CREATE TABLE "_FavoritedArticles" ( - "A" INTEGER NOT NULL, - "B" INTEGER NOT NULL, - - FOREIGN KEY ("A") REFERENCES "Article"("id") ON DELETE CASCADE ON UPDATE CASCADE, - FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE -) - -CREATE UNIQUE INDEX "_FavoritedArticles_AB_unique" ON "_FavoritedArticles"("A", "B") - -CREATE INDEX "_FavoritedArticles_B_index" ON "_FavoritedArticles"("B") -``` - -## Changes - -```diff -diff --git schema.prisma schema.prisma -migration 20201125134317-added-article-tag..20201126162628-added-favorite-articles ---- datamodel.dml -+++ datamodel.dml -@@ -1,8 +1,8 @@ - datasource db { - provider = "sqlite" -- url = "***" -+ url = "***" - } - generator client { - provider = "prisma-client-js" -@@ -18,8 +18,9 @@ - profilePictureUrl String? - articles Article[] - comments Comment[] -+ favoriteArticles Article[] @relation("FavoritedArticles") - } - model Article { - id Int @id @default(autoincrement()) -@@ -33,8 +34,9 @@ - user User @relation(fields: [userId], references: [id]) - userId Int - comments Comment[] - tags ArticleTag[] -+ favoritedBy User[] @relation("FavoritedArticles") - } - model Comment { - id Int @id @default(autoincrement()) -``` - - diff --git a/examples/realworld/migrations/20201126162628-added-favorite-articles/steps.json b/examples/realworld/migrations/20201126162628-added-favorite-articles/steps.json deleted file mode 100644 index 9cb7ba3c4..000000000 --- a/examples/realworld/migrations/20201126162628-added-favorite-articles/steps.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "version": "0.3.14-fixed", - "steps": [ - { - "tag": "CreateField", - "model": "User", - "field": "favoriteArticles", - "type": "Article", - "arity": "List" - }, - { - "tag": "CreateDirective", - "location": { - "path": { - "tag": "Field", - "model": "User", - "field": "favoriteArticles" - }, - "directive": "relation" - } - }, - { - "tag": "CreateArgument", - "location": { - "tag": "Directive", - "path": { - "tag": "Field", - "model": "User", - "field": "favoriteArticles" - }, - "directive": "relation" - }, - "argument": "", - "value": "\"FavoritedArticles\"" - }, - { - "tag": "CreateField", - "model": "Article", - "field": "favoritedBy", - "type": "User", - "arity": "List" - }, - { - "tag": "CreateDirective", - "location": { - "path": { - "tag": "Field", - "model": "Article", - "field": "favoritedBy" - }, - "directive": "relation" - } - }, - { - "tag": "CreateArgument", - "location": { - "tag": "Directive", - "path": { - "tag": "Field", - "model": "Article", - "field": "favoritedBy" - }, - "directive": "relation" - }, - "argument": "", - "value": "\"FavoritedArticles\"" - } - ] -} \ No newline at end of file diff --git a/examples/realworld/migrations/20201127131647-init/README.md b/examples/realworld/migrations/20201127131647-init/README.md new file mode 100644 index 000000000..58d33df20 --- /dev/null +++ b/examples/realworld/migrations/20201127131647-init/README.md @@ -0,0 +1,145 @@ +# Migration `20201127131647-init` + +This migration has been generated by Martin Sosic at 11/27/2020, 2:16:47 PM. +You can check out the [state of the schema](./schema.prisma) after the migration. + +## Database Steps + +```sql +CREATE TABLE "User" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "username" TEXT NOT NULL, + "email" TEXT NOT NULL, + "password" TEXT NOT NULL, + "bio" TEXT, + "profilePictureUrl" TEXT +) + +CREATE TABLE "Article" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "slug" TEXT NOT NULL, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" DATETIME NOT NULL, + "title" TEXT NOT NULL, + "description" TEXT NOT NULL, + "markdownContent" TEXT NOT NULL, + "userId" INTEGER NOT NULL, + + FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE +) + +CREATE TABLE "Comment" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "content" TEXT NOT NULL, + "userId" INTEGER NOT NULL, + "articleId" INTEGER NOT NULL, + + FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE, + FOREIGN KEY ("articleId") REFERENCES "Article"("id") ON DELETE CASCADE ON UPDATE CASCADE +) + +CREATE TABLE "ArticleTag" ( + "name" TEXT NOT NULL, + PRIMARY KEY ("name") +) + +CREATE TABLE "_FavoritedArticles" ( + "A" INTEGER NOT NULL, + "B" INTEGER NOT NULL, + + FOREIGN KEY ("A") REFERENCES "Article"("id") ON DELETE CASCADE ON UPDATE CASCADE, + FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE +) + +CREATE TABLE "_ArticleToArticleTag" ( + "A" INTEGER NOT NULL, + "B" TEXT NOT NULL, + + FOREIGN KEY ("A") REFERENCES "Article"("id") ON DELETE CASCADE ON UPDATE CASCADE, + FOREIGN KEY ("B") REFERENCES "ArticleTag"("name") ON DELETE CASCADE ON UPDATE CASCADE +) + +CREATE UNIQUE INDEX "User.username_unique" ON "User"("username") + +CREATE UNIQUE INDEX "User.email_unique" ON "User"("email") + +CREATE UNIQUE INDEX "Article.slug_unique" ON "Article"("slug") + +CREATE UNIQUE INDEX "_FavoritedArticles_AB_unique" ON "_FavoritedArticles"("A", "B") + +CREATE INDEX "_FavoritedArticles_B_index" ON "_FavoritedArticles"("B") + +CREATE UNIQUE INDEX "_ArticleToArticleTag_AB_unique" ON "_ArticleToArticleTag"("A", "B") + +CREATE INDEX "_ArticleToArticleTag_B_index" ON "_ArticleToArticleTag"("B") +``` + +## Changes + +```diff +diff --git schema.prisma schema.prisma +migration ..20201127131647-init +--- datamodel.dml ++++ datamodel.dml +@@ -1,0 +1,57 @@ ++ ++datasource db { ++ provider = "sqlite" ++ url = "***" ++} ++ ++generator client { ++ provider = "prisma-client-js" ++ output = "../server/node_modules/.prisma/client" ++} ++ ++model User { ++ id Int @id @default(autoincrement()) ++ username String @unique ++ email String @unique ++ password String ++ bio String? ++ profilePictureUrl String? ++ ++ articles Article[] ++ comments Comment[] ++ favoriteArticles Article[] @relation("FavoritedArticles") ++} ++ ++model Article { ++ id Int @id @default(autoincrement()) ++ slug String @unique ++ createdAt DateTime @default(now()) ++ updatedAt DateTime @updatedAt ++ title String ++ description String ++ markdownContent String ++ ++ user User @relation(fields: [userId], references: [id]) ++ userId Int ++ comments Comment[] ++ tags ArticleTag[] ++ favoritedBy User[] @relation("FavoritedArticles") ++} ++ ++model Comment { ++ id Int @id @default(autoincrement()) ++ createdAt DateTime @default(now()) ++ content String ++ ++ user User @relation(fields: [userId], references: [id]) ++ userId Int ++ article Article @relation(fields: [articleId], references: [id]) ++ articleId Int ++} ++ ++model ArticleTag { ++ name String @id ++ ++ articles Article[] ++} ++ +``` + + diff --git a/examples/realworld/migrations/20201126162628-added-favorite-articles/schema.prisma b/examples/realworld/migrations/20201127131647-init/schema.prisma similarity index 100% rename from examples/realworld/migrations/20201126162628-added-favorite-articles/schema.prisma rename to examples/realworld/migrations/20201127131647-init/schema.prisma diff --git a/examples/realworld/migrations/20201127131647-init/steps.json b/examples/realworld/migrations/20201127131647-init/steps.json new file mode 100644 index 000000000..e67fffe3f --- /dev/null +++ b/examples/realworld/migrations/20201127131647-init/steps.json @@ -0,0 +1,633 @@ +{ + "version": "0.3.14-fixed", + "steps": [ + { + "tag": "CreateSource", + "source": "db" + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Source", + "source": "db" + }, + "argument": "provider", + "value": "\"sqlite\"" + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Source", + "source": "db" + }, + "argument": "url", + "value": "\"***\"" + }, + { + "tag": "CreateModel", + "model": "User" + }, + { + "tag": "CreateField", + "model": "User", + "field": "id", + "type": "Int", + "arity": "Required" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "User", + "field": "id" + }, + "directive": "id" + } + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "User", + "field": "id" + }, + "directive": "default" + } + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Directive", + "path": { + "tag": "Field", + "model": "User", + "field": "id" + }, + "directive": "default" + }, + "argument": "", + "value": "autoincrement()" + }, + { + "tag": "CreateField", + "model": "User", + "field": "username", + "type": "String", + "arity": "Required" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "User", + "field": "username" + }, + "directive": "unique" + } + }, + { + "tag": "CreateField", + "model": "User", + "field": "email", + "type": "String", + "arity": "Required" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "User", + "field": "email" + }, + "directive": "unique" + } + }, + { + "tag": "CreateField", + "model": "User", + "field": "password", + "type": "String", + "arity": "Required" + }, + { + "tag": "CreateField", + "model": "User", + "field": "bio", + "type": "String", + "arity": "Optional" + }, + { + "tag": "CreateField", + "model": "User", + "field": "profilePictureUrl", + "type": "String", + "arity": "Optional" + }, + { + "tag": "CreateField", + "model": "User", + "field": "articles", + "type": "Article", + "arity": "List" + }, + { + "tag": "CreateField", + "model": "User", + "field": "comments", + "type": "Comment", + "arity": "List" + }, + { + "tag": "CreateField", + "model": "User", + "field": "favoriteArticles", + "type": "Article", + "arity": "List" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "User", + "field": "favoriteArticles" + }, + "directive": "relation" + } + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Directive", + "path": { + "tag": "Field", + "model": "User", + "field": "favoriteArticles" + }, + "directive": "relation" + }, + "argument": "", + "value": "\"FavoritedArticles\"" + }, + { + "tag": "CreateModel", + "model": "Article" + }, + { + "tag": "CreateField", + "model": "Article", + "field": "id", + "type": "Int", + "arity": "Required" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "Article", + "field": "id" + }, + "directive": "id" + } + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "Article", + "field": "id" + }, + "directive": "default" + } + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Directive", + "path": { + "tag": "Field", + "model": "Article", + "field": "id" + }, + "directive": "default" + }, + "argument": "", + "value": "autoincrement()" + }, + { + "tag": "CreateField", + "model": "Article", + "field": "slug", + "type": "String", + "arity": "Required" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "Article", + "field": "slug" + }, + "directive": "unique" + } + }, + { + "tag": "CreateField", + "model": "Article", + "field": "createdAt", + "type": "DateTime", + "arity": "Required" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "Article", + "field": "createdAt" + }, + "directive": "default" + } + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Directive", + "path": { + "tag": "Field", + "model": "Article", + "field": "createdAt" + }, + "directive": "default" + }, + "argument": "", + "value": "now()" + }, + { + "tag": "CreateField", + "model": "Article", + "field": "updatedAt", + "type": "DateTime", + "arity": "Required" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "Article", + "field": "updatedAt" + }, + "directive": "updatedAt" + } + }, + { + "tag": "CreateField", + "model": "Article", + "field": "title", + "type": "String", + "arity": "Required" + }, + { + "tag": "CreateField", + "model": "Article", + "field": "description", + "type": "String", + "arity": "Required" + }, + { + "tag": "CreateField", + "model": "Article", + "field": "markdownContent", + "type": "String", + "arity": "Required" + }, + { + "tag": "CreateField", + "model": "Article", + "field": "user", + "type": "User", + "arity": "Required" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "Article", + "field": "user" + }, + "directive": "relation" + } + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Directive", + "path": { + "tag": "Field", + "model": "Article", + "field": "user" + }, + "directive": "relation" + }, + "argument": "fields", + "value": "[userId]" + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Directive", + "path": { + "tag": "Field", + "model": "Article", + "field": "user" + }, + "directive": "relation" + }, + "argument": "references", + "value": "[id]" + }, + { + "tag": "CreateField", + "model": "Article", + "field": "userId", + "type": "Int", + "arity": "Required" + }, + { + "tag": "CreateField", + "model": "Article", + "field": "comments", + "type": "Comment", + "arity": "List" + }, + { + "tag": "CreateField", + "model": "Article", + "field": "tags", + "type": "ArticleTag", + "arity": "List" + }, + { + "tag": "CreateField", + "model": "Article", + "field": "favoritedBy", + "type": "User", + "arity": "List" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "Article", + "field": "favoritedBy" + }, + "directive": "relation" + } + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Directive", + "path": { + "tag": "Field", + "model": "Article", + "field": "favoritedBy" + }, + "directive": "relation" + }, + "argument": "", + "value": "\"FavoritedArticles\"" + }, + { + "tag": "CreateModel", + "model": "Comment" + }, + { + "tag": "CreateField", + "model": "Comment", + "field": "id", + "type": "Int", + "arity": "Required" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "Comment", + "field": "id" + }, + "directive": "id" + } + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "Comment", + "field": "id" + }, + "directive": "default" + } + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Directive", + "path": { + "tag": "Field", + "model": "Comment", + "field": "id" + }, + "directive": "default" + }, + "argument": "", + "value": "autoincrement()" + }, + { + "tag": "CreateField", + "model": "Comment", + "field": "createdAt", + "type": "DateTime", + "arity": "Required" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "Comment", + "field": "createdAt" + }, + "directive": "default" + } + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Directive", + "path": { + "tag": "Field", + "model": "Comment", + "field": "createdAt" + }, + "directive": "default" + }, + "argument": "", + "value": "now()" + }, + { + "tag": "CreateField", + "model": "Comment", + "field": "content", + "type": "String", + "arity": "Required" + }, + { + "tag": "CreateField", + "model": "Comment", + "field": "user", + "type": "User", + "arity": "Required" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "Comment", + "field": "user" + }, + "directive": "relation" + } + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Directive", + "path": { + "tag": "Field", + "model": "Comment", + "field": "user" + }, + "directive": "relation" + }, + "argument": "fields", + "value": "[userId]" + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Directive", + "path": { + "tag": "Field", + "model": "Comment", + "field": "user" + }, + "directive": "relation" + }, + "argument": "references", + "value": "[id]" + }, + { + "tag": "CreateField", + "model": "Comment", + "field": "userId", + "type": "Int", + "arity": "Required" + }, + { + "tag": "CreateField", + "model": "Comment", + "field": "article", + "type": "Article", + "arity": "Required" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "Comment", + "field": "article" + }, + "directive": "relation" + } + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Directive", + "path": { + "tag": "Field", + "model": "Comment", + "field": "article" + }, + "directive": "relation" + }, + "argument": "fields", + "value": "[articleId]" + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Directive", + "path": { + "tag": "Field", + "model": "Comment", + "field": "article" + }, + "directive": "relation" + }, + "argument": "references", + "value": "[id]" + }, + { + "tag": "CreateField", + "model": "Comment", + "field": "articleId", + "type": "Int", + "arity": "Required" + }, + { + "tag": "CreateModel", + "model": "ArticleTag" + }, + { + "tag": "CreateField", + "model": "ArticleTag", + "field": "name", + "type": "String", + "arity": "Required" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "ArticleTag", + "field": "name" + }, + "directive": "id" + } + }, + { + "tag": "CreateField", + "model": "ArticleTag", + "field": "articles", + "type": "Article", + "arity": "List" + } + ] +} \ No newline at end of file diff --git a/examples/realworld/migrations/migrate.lock b/examples/realworld/migrations/migrate.lock index ba825961f..55fc05fdc 100644 --- a/examples/realworld/migrations/migrate.lock +++ b/examples/realworld/migrations/migrate.lock @@ -1,11 +1,3 @@ # Prisma Migrate lockfile v1 -20201030161549-user -20201030185724-fixed-user -20201117145436-added-bio-and-picture-to-user -20201119144622-added-article-entity -20201124192901-added-created-at-to-article -20201124195623-added-slug-to-article -20201124212222-added-comment -20201125134317-added-article-tag -20201126162628-added-favorite-articles \ No newline at end of file +20201127131647-init \ No newline at end of file