kapi-mvc-blank 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -114,10 +114,16 @@ src/
|
|
|
114
114
|
|
|
115
115
|
4. **Configurer Prisma**
|
|
116
116
|
```bash
|
|
117
|
+
# Si vous rencontrez des problème avec prisma aller sur la doc [https://www.prisma.io/docs/getting-started/prisma-orm/quickstart/mysql]
|
|
118
|
+
# Vous allez générer les fichiers models de prisma dans schema.prisma vérifier les information de connection a votre db dans votre fichier .env
|
|
119
|
+
npx prisma init --datasource-provider mysql --output ../generated/prisma
|
|
120
|
+
# dans le ./prisma/schema.prisma utiliser le provider js si vous n etes pas en typescript provider = "prisma-client-js"
|
|
121
|
+
|
|
122
|
+
npx prisma db pull
|
|
123
|
+
|
|
117
124
|
npx prisma migrate dev --name init
|
|
118
125
|
npx prisma generate
|
|
119
|
-
|
|
120
|
-
# you probable nead model in schema.prisma or complete tour DSN in tour .env
|
|
126
|
+
|
|
121
127
|
```
|
|
122
128
|
|
|
123
129
|
5. **Vérifier l'installation**
|
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -7,19 +7,3 @@ datasource db {
|
|
|
7
7
|
provider = "mysql"
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
model User {
|
|
12
|
-
id Int @id @default(autoincrement())
|
|
13
|
-
email String @unique
|
|
14
|
-
name String?
|
|
15
|
-
posts Post[]
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
model Post {
|
|
19
|
-
id Int @id @default(autoincrement())
|
|
20
|
-
title String
|
|
21
|
-
content String?
|
|
22
|
-
published Boolean @default(false)
|
|
23
|
-
author User @relation(fields: [authorId], references: [id])
|
|
24
|
-
authorId Int
|
|
25
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
-- CreateTable
|
|
2
|
-
CREATE TABLE `User` (
|
|
3
|
-
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
|
4
|
-
`email` VARCHAR(191) NOT NULL,
|
|
5
|
-
`name` VARCHAR(191) NULL,
|
|
6
|
-
|
|
7
|
-
UNIQUE INDEX `User_email_key`(`email`),
|
|
8
|
-
PRIMARY KEY (`id`)
|
|
9
|
-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
10
|
-
|
|
11
|
-
-- CreateTable
|
|
12
|
-
CREATE TABLE `Post` (
|
|
13
|
-
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
|
14
|
-
`title` VARCHAR(191) NOT NULL,
|
|
15
|
-
`content` VARCHAR(191) NULL,
|
|
16
|
-
`published` BOOLEAN NOT NULL DEFAULT false,
|
|
17
|
-
`authorId` INTEGER NOT NULL,
|
|
18
|
-
|
|
19
|
-
PRIMARY KEY (`id`)
|
|
20
|
-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
21
|
-
|
|
22
|
-
-- AddForeignKey
|
|
23
|
-
ALTER TABLE `Post` ADD CONSTRAINT `Post_authorId_fkey` FOREIGN KEY (`authorId`) REFERENCES `User`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|