lapeh 2.0.9 → 2.1.0
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/package.json +1 -2
- package/src/prisma.ts +1 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lapeh",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Framework API Express yang siap pakai (Standardized)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
"license": "MIT",
|
|
46
46
|
"type": "commonjs",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@prisma/adapter-mariadb": "7.2.0",
|
|
49
48
|
"@prisma/adapter-pg": "7.2.0",
|
|
50
49
|
"@prisma/client": "7.2.0",
|
|
51
50
|
"bcryptjs": "3.0.3",
|
package/src/prisma.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { PrismaClient } from "../generated/prisma";
|
|
2
2
|
import { PrismaPg } from "@prisma/adapter-pg";
|
|
3
|
-
import { PrismaMariaDb } from "@prisma/adapter-mariadb";
|
|
4
3
|
|
|
5
4
|
const url = process.env.DATABASE_URL || "";
|
|
6
5
|
const provider = (process.env.DATABASE_PROVIDER || "").toLowerCase();
|
|
@@ -10,23 +9,8 @@ let prisma: PrismaClient;
|
|
|
10
9
|
if (provider === "postgresql" || url.startsWith("postgres")) {
|
|
11
10
|
const adapter = new PrismaPg({ connectionString: url });
|
|
12
11
|
prisma = new PrismaClient({ adapter });
|
|
13
|
-
} else if (
|
|
14
|
-
provider === "mysql" ||
|
|
15
|
-
provider === "mariadb" ||
|
|
16
|
-
url.startsWith("mysql") ||
|
|
17
|
-
url.startsWith("mariadb")
|
|
18
|
-
) {
|
|
19
|
-
const adapter = new PrismaMariaDb({
|
|
20
|
-
host: process.env.DATABASE_HOST,
|
|
21
|
-
user: process.env.DATABASE_USER,
|
|
22
|
-
password: process.env.DATABASE_PASSWORD,
|
|
23
|
-
database: process.env.DATABASE_NAME,
|
|
24
|
-
} as any);
|
|
25
|
-
prisma = new PrismaClient({ adapter });
|
|
26
12
|
} else {
|
|
27
|
-
|
|
28
|
-
'Unsupported DATABASE_PROVIDER. Use "postgresql" or "mysql".'
|
|
29
|
-
);
|
|
13
|
+
prisma = new PrismaClient();
|
|
30
14
|
}
|
|
31
15
|
|
|
32
16
|
export { prisma };
|