wasp/examples/tutorials/TodoApp/migrations/20201023121536-b
2020-10-23 14:51:57 +02:00
..
README.md Updated tutorial todoApp example with authentication. 2020-10-23 14:51:57 +02:00
schema.prisma Updated tutorial todoApp example with authentication. 2020-10-23 14:51:57 +02:00
steps.json Updated tutorial todoApp example with authentication. 2020-10-23 14:51:57 +02:00

Migration 20201023121536-b

This migration has been generated by Martin Sosic at 10/23/2020, 2:15:36 PM. You can check out the state of the schema after the migration.

Database Steps

PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Task" (
    "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
    "description" TEXT NOT NULL,
    "isDone" BOOLEAN NOT NULL DEFAULT false,
    "userId" INTEGER,

    FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE
);
INSERT INTO "new_Task" ("id", "description", "isDone") SELECT "id", "description", "isDone" FROM "Task";
DROP TABLE "Task";
ALTER TABLE "new_Task" RENAME TO "Task";
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON

Changes

diff --git schema.prisma schema.prisma
migration 20201023121126-a..20201023121536-b
--- datamodel.dml
+++ datamodel.dml
@@ -1,8 +1,8 @@
 datasource db {
   provider = "sqlite"
-  url = "***"
+  url = "***"
 }
 generator client {
   provider = "prisma-client-js"
@@ -12,12 +12,15 @@
 model User {
     id          Int     @id @default(autoincrement())
     email       String  @unique
     password    String
+    tasks       Task[]
 }
 model Task {
     id          Int     @id @default(autoincrement())
     description String
     isDone      Boolean @default(false)
+    user        User?    @relation(fields: [userId], references: [id])
+    userId      Int?
 }