wasp/examples/realworld/migrations/20201127145135-added-following-of-other-users
2020-11-27 16:10:02 +01:00
..
README.md Added following other users. 2020-11-27 16:10:02 +01:00
schema.prisma Added following other users. 2020-11-27 16:10:02 +01:00
steps.json Added following other users. 2020-11-27 16:10:02 +01:00

Migration 20201127145135-added-following-of-other-users

This migration has been generated by Martin Sosic at 11/27/2020, 3:51:35 PM. You can check out the state of the schema after the migration.

Database Steps

CREATE TABLE "_FollowedUser" (
    "A" INTEGER NOT NULL,
    "B" INTEGER NOT NULL,

    FOREIGN KEY ("A") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE,
    FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE
)

CREATE UNIQUE INDEX "_FollowedUser_AB_unique" ON "_FollowedUser"("A", "B")

CREATE INDEX "_FollowedUser_B_index" ON "_FollowedUser"("B")

Changes

diff --git schema.prisma schema.prisma
migration 20201127131647-init..20201127145135-added-following-of-other-users
--- datamodel.dml
+++ datamodel.dml
@@ -1,8 +1,8 @@
 datasource db {
   provider = "sqlite"
-  url = "***"
+  url = "***"
 }
 generator client {
   provider = "prisma-client-js"
@@ -19,8 +19,10 @@
     articles          Article[]
     comments          Comment[]
     favoriteArticles  Article[] @relation("FavoritedArticles")
+    followedBy        User[]    @relation("FollowedUser", references: [id])
+    following         User[]    @relation("FollowedUser", references: [id])
 }
 model Article {
     id              Int      @id @default(autoincrement())