easy-mysql-js
Advanced tools
Comparing version 1.0.1 to 1.0.2
13
index.js
@@ -15,4 +15,15 @@ /* | ||
const { Prisma } = require('@prisma/client') | ||
const prisma = require("./prisma/prisma.js") | ||
const { PrismaClient } = require('@prisma/client') | ||
let prisma; | ||
if (process.env.NODE_ENV === 'production') { | ||
prisma = new PrismaClient(); | ||
} else { | ||
if (!global.prisma) { | ||
global.prisma = new PrismaClient(); | ||
} | ||
prisma = global.prisma; | ||
} | ||
// -------------------------------------------------------------------------------------------------- | ||
@@ -19,0 +30,0 @@ // Select ------------------------------------------------------------------------------------------- |
{ | ||
"name": "easy-mysql-js", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Easy MySQL for NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -17,6 +17,21 @@ # easy-mysql-js | ||
Install the package | ||
```shell | ||
$ npm i easy-mysql-js | ||
``` | ||
Initialize prisma | ||
```shell | ||
$ npx prisma init | ||
``` | ||
NOTE: If you update your database tables, columns, etc. you need to run: | ||
```shell | ||
$ npx prisma db pull | ||
$ npx prisma generate | ||
``` | ||
## Environment Variables | ||
@@ -26,5 +41,5 @@ | ||
`DATABASE_URL` | ||
`DATABASE_URL="mysql://your_db_username:your_db_password@your_ip_address:3306/your_db_name"` | ||
`NODE_ENV` | ||
`NODE_ENV="development"` | ||
@@ -34,4 +49,4 @@ | ||
*** | ||
## Select | ||
@@ -38,0 +53,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13968
297
5
173