prisma-client-php 2.3.0 → 2.3.1

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/dist/init.js CHANGED
@@ -72,9 +72,6 @@ function installNpmDependencies(isPrismaPHP) {
72
72
  if (fs.existsSync(packageJsonPath)) {
73
73
  const packageJsonContent = fs.readFileSync(packageJsonPath, "utf8");
74
74
  packageJson = JSON.parse(packageJsonContent);
75
- packageJson.prisma = {
76
- seed: "tsx prisma/seed.ts",
77
- };
78
75
  if (!isPrismaPHP) {
79
76
  packageJson.type = "module";
80
77
  }
@@ -224,6 +221,17 @@ async function main() {
224
221
  isPrismaPHP
225
222
  );
226
223
  });
224
+ function copyFileVerbose(src, dest) {
225
+ if (!fs.existsSync(src)) {
226
+ console.warn(`File not found (skip): ${src}`);
227
+ return;
228
+ }
229
+ fs.copyFileSync(src, dest);
230
+ console.log(`Copied file: ${path.basename(src)} -> ${dest}`);
231
+ }
232
+ const prismaConfigSrc = path.join(__dirname, "prisma.config.ts");
233
+ const prismaConfigDest = path.join(process.cwd(), "prisma.config.ts");
234
+ copyFileVerbose(prismaConfigSrc, prismaConfigDest);
227
235
  console.log("Finished copying directories.");
228
236
  }
229
237
  // Run the main function
@@ -1,28 +1,28 @@
1
- // import { PrismaClient } from "@prisma/client";
1
+ import { PrismaClient } from "@prisma/client";
2
2
 
3
- // const prisma = new PrismaClient();
3
+ const prisma = new PrismaClient();
4
4
 
5
- // // UserRole
6
- // const userRoleData = [
7
- // {
8
- // name: "Admin",
9
- // },
10
- // {
11
- // name: "User",
12
- // },
13
- // ];
5
+ const userRoleData = [
6
+ {
7
+ id: 1,
8
+ name: "Admin",
9
+ },
10
+ {
11
+ id: 2,
12
+ name: "User",
13
+ },
14
+ ];
14
15
 
15
- // // User
16
- // const userData = [
17
- // {
18
- // name: "Juan",
19
- // email: "j@gmail.com",
20
- // password: "$2b$10$mgjotYzIXwrK1MCWmu4tgeUVnLcb.qzvqwxOq4FXEL8k2obwXivDi", // TODO: template password 1234 (bcrypt) testing only
21
- // roleId: 1,
22
- // },
23
- // ];
16
+ const userData = [
17
+ {
18
+ name: "Juan",
19
+ email: "j@gmail.com",
20
+ password: "$2b$10$mgjotYzIXwrK1MCWmu4tgeUVnLcb.qzvqwxOq4FXEL8k2obwXivDi", // TODO: template password 1234 (bcrypt) testing only
21
+ roleId: 1,
22
+ },
23
+ ];
24
24
 
25
- // async function main() {
25
+ async function main() {
26
26
  // ========================================
27
27
  // Code for PostgreSQL
28
28
  // ----------------------------------------
@@ -63,12 +63,12 @@
63
63
  // await prisma.user.deleteMany();
64
64
  // await prisma.user.createMany({ data: userData });
65
65
  // ========================================
66
- // }
66
+ }
67
67
 
68
- // main()
69
- // .catch((e) => {
70
- // throw e;
71
- // })
72
- // .finally(async () => {
73
- // await prisma.$disconnect();
74
- // });
68
+ main()
69
+ .catch((e) => {
70
+ throw e;
71
+ })
72
+ .finally(async () => {
73
+ await prisma.$disconnect();
74
+ });
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from "prisma/config";
2
+ import "dotenv/config";
3
+
4
+ export default defineConfig({
5
+ schema: "prisma/schema.prisma",
6
+ migrations: {
7
+ path: "prisma/migrations",
8
+ seed: "tsx prisma/seed.ts",
9
+ },
10
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "prisma-client-php",
3
3
  "description": "Prisma Client PHP is an auto-generated query builder that enables type-safe database access in PHP.",
4
- "version": "2.3.0",
4
+ "version": "2.3.1",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "scripts": {