安装前提条件:
1、已经安装了docker运行环境
2、以下命令执行记录发生在MackBook环境
3、已经安装了PostgreSQL(我使用的是11版本)
4、Node开发运行环境可以正常工作
首先需要通过Node包管理器安装Prisma工具:
npm install -g prisma
然后,创建并初始化prisma项目:
prisma init prisma-study
? Set up a new Prisma server or deploy to an existing server? (Use arrow keys)
You can set up Prisma for local development (based on docker-compose)
❯ Use existing database Connect to existing database
Create new database Set up a local database using Docker
Or deploy to an existing Prisma server:
Demo server Hosted demo environment incl. database (requires login)
Use other server Manually provide endpoint of a running Prisma server
选择使用已存在的数据库(Use existing database)后,回车确认选择。
? Set up a new Prisma server or deploy to an existing server? Use existing database
? What kind of database do you want to deploy to?
MySQL MySQL compliant databases like MySQL or MariaDB
❯ PostgreSQL PostgreSQL database
移动上下箭头键盘按键,选择PostgreSQL后,再次回车确认选择。
? Set up a new Prisma server or deploy to an existing server? Use existing database
? What kind of database do you want to deploy to? PostgreSQL
? Does your database contain existing data? (Use arrow keys)
❯ No