feat(api-db): initialize prisma with postgresql datasource

This commit is contained in:
2026-04-04 12:58:14 +08:00
parent d567710768
commit fba9443a30
7 changed files with 1174 additions and 8 deletions
+1
View File
@@ -0,0 +1 @@
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/todolist?schema=public"
+5
View File
@@ -0,0 +1,5 @@
node_modules
# Keep environment variables out of version control
.env
/generated/prisma
View File
+19
View File
@@ -0,0 +1,19 @@
{
"name": "@todolist/api",
"version": "0.1.0",
"description": "TodoList API service",
"scripts": {
"prisma:generate": "prisma generate",
"prisma:format": "prisma format",
"prisma:validate": "prisma validate"
},
"license": "GPL-3.0-or-later",
"devDependencies": {
"dotenv": "^16.6.1",
"prisma": "^7.6.0"
},
"private": true,
"dependencies": {
"@prisma/client": "^7.6.0"
}
}
+14
View File
@@ -0,0 +1,14 @@
// This file was generated by Prisma, and assumes you have installed the following:
// npm install --save-dev prisma dotenv
import "dotenv/config";
import { defineConfig } from "prisma/config";
export default defineConfig({
schema: "prisma/schema.prisma",
migrations: {
path: "prisma/migrations"
},
datasource: {
url: process.env["DATABASE_URL"]
}
});
+13
View File
@@ -0,0 +1,13 @@
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
// Get a free hosted Postgres database in seconds: `npx create-db`
generator client {
provider = "prisma-client"
output = "../generated/prisma"
}
datasource db {
provider = "postgresql"
}