Просмотр исходного кода

chore(@growi/app): prisma init

mizozobu 1 месяц назад
Родитель
Сommit
978ae75495
4 измененных файлов с 40 добавлено и 0 удалено
  1. 8 0
      apps/app/.env
  2. 2 0
      apps/app/.gitignore
  3. 15 0
      apps/app/prisma.config.ts
  4. 15 0
      apps/app/prisma/schema.prisma

+ 8 - 0
apps/app/.env

@@ -0,0 +1,8 @@
+# Environment variables declared in this file are NOT automatically loaded by Prisma.
+# Please add `import "dotenv/config";` to your `prisma.config.ts` file, or use the Prisma CLI with Bun
+# to load environment variables from .env files: https://pris.ly/prisma-config-env-vars.
+
+# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
+# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
+
+DATABASE_URL="mongodb+srv://root:randompassword@cluster0.ab1cd.mongodb.net/mydb?retryWrites=true&w=majority"

+ 2 - 0
apps/app/.gitignore

@@ -17,3 +17,5 @@
 
 
 # cache
 # cache
 /.swc/
 /.swc/
+
+/generated/prisma

+ 15 - 0
apps/app/prisma.config.ts

@@ -0,0 +1,15 @@
+// This file was generated by Prisma and assumes you have installed the following:
+// npm install --save-dev prisma dotenv
+import 'dotenv/config';
+import { defineConfig, env } from 'prisma/config';
+
+export default defineConfig({
+  schema: 'prisma/schema.prisma',
+  migrations: {
+    path: 'prisma/migrations',
+  },
+  engine: 'classic',
+  datasource: {
+    url: env('DATABASE_URL'),
+  },
+});

+ 15 - 0
apps/app/prisma/schema.prisma

@@ -0,0 +1,15 @@
+// This is your Prisma schema file,
+// learn more about it in the docs: https://pris.ly/d/prisma-schema
+
+// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
+// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
+
+generator client {
+  provider = "prisma-client"
+  output   = "../generated/prisma"
+}
+
+datasource db {
+  provider = "mongodb"
+  url      = env("DATABASE_URL")
+}