Moray
Moray
Explore posts from servers
PPrisma
Created by Moray on 11/23/2024 in #help-and-questions
Amazon Linux 2023 support
I'm trying (and failing) to run Prisma on Node 16 on AL2023 (x86_64. Am I right in thinking that it's not compatible as it's not downstream of Alpine, Debian or RHEL?
21 replies
DTDrizzle Team
Created by Moray on 10/11/2024 in #help
Error when pulling from MySQL
I'm following the instructions on https://orm.drizzle.team/docs/get-started/mysql-existing and have just installed Drizzle Kit 0.25.0. However when I run yarn drizzle-kit pull, I get the following error:
/<path redacted>/node_modules/drizzle-kit/bin.cjs:30727
Request2 = class extends GlobalRequest {
^

TypeError: Class extends value undefined is not a constructor or null
at ../node_modules/.pnpm/@[email protected]/node_modules/@hono/node-server/dist/index.mjs (/<path redacted>/node_modules/drizzle-kit/bin.cjs:30727:5)
at __init (/<path redacted>/node_modules/drizzle-kit/bin.cjs:10:56)
at src/serializer/studio.ts (/<path redacted>/node_modules/drizzle-kit/bin.cjs:62369:5)
at __init (/<path redacted>/node_modules/drizzle-kit/bin.cjs:10:56)
at Object.<anonymous> (/<path redacted>/node_modules/drizzle-kit/bin.cjs:83722:1)
at Module._compile (node:internal/modules/cjs/loader:1198:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
at Module.load (node:internal/modules/cjs/loader:1076:32)
at Function.Module._load (node:internal/modules/cjs/loader:911:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
/<path redacted>/node_modules/drizzle-kit/bin.cjs:30727
Request2 = class extends GlobalRequest {
^

TypeError: Class extends value undefined is not a constructor or null
at ../node_modules/.pnpm/@[email protected]/node_modules/@hono/node-server/dist/index.mjs (/<path redacted>/node_modules/drizzle-kit/bin.cjs:30727:5)
at __init (/<path redacted>/node_modules/drizzle-kit/bin.cjs:10:56)
at src/serializer/studio.ts (/<path redacted>/node_modules/drizzle-kit/bin.cjs:62369:5)
at __init (/<path redacted>/node_modules/drizzle-kit/bin.cjs:10:56)
at Object.<anonymous> (/<path redacted>/node_modules/drizzle-kit/bin.cjs:83722:1)
at Module._compile (node:internal/modules/cjs/loader:1198:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
at Module.load (node:internal/modules/cjs/loader:1076:32)
at Function.Module._load (node:internal/modules/cjs/loader:911:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
I'm using Node 16 on Linux 6.11.2-arch1-1 Any ideas?
1 replies
PPrisma
Created by Moray on 8/23/2024 in #help-and-questions
Introspecting an existing database doesn't handle join tables correctly
I'm in the process of adding Prisma to an existing project with a large existing database (originally created with Prisma 1). I've introspected the database and edited the schema so that the names of the relation fields are cased correctly. I then created an initial migration SQL file as per the guide and marked it as applied. When I try to create a new migration, I keep getting errors telling me that ALL of my existing JOIN tables are incorrect:
Drift detected: Your database schema is not in sync with your migration history.

The following is a summary of the differences between the expected database schema given your migrations files, and the actual schema of the database.

It should be understood as the set of changes to get from the expected schema to the actual schema.

[*] Changed the `_RoleToTenantUser` table
[-] Removed foreign key on columns (A)
[-] Removed foreign key on columns (B)
[+] Added foreign key on columns (A)
[+] Added foreign key on columns (B)
[*] Renamed index `_RoleToTenantUser_AB_unique` to `RoleToTenantUser_AB_unique`
[*] Renamed index `_RoleToTenantUser_B_index` to `B`

... continued for the other 87 join tables in my schema ...
Drift detected: Your database schema is not in sync with your migration history.

The following is a summary of the differences between the expected database schema given your migrations files, and the actual schema of the database.

It should be understood as the set of changes to get from the expected schema to the actual schema.

[*] Changed the `_RoleToTenantUser` table
[-] Removed foreign key on columns (A)
[-] Removed foreign key on columns (B)
[+] Added foreign key on columns (A)
[+] Added foreign key on columns (B)
[*] Renamed index `_RoleToTenantUser_AB_unique` to `RoleToTenantUser_AB_unique`
[*] Renamed index `_RoleToTenantUser_B_index` to `B`

... continued for the other 87 join tables in my schema ...
What's going on here, and how do I fix it?
3 replies
PPrisma
Created by Moray on 8/19/2024 in #help-and-questions
Why are client files generated in node_modules and what does that mean for production builds?
In Prisma 1, generated files were kept within source control. This makes sense to me as it meant edits to the schemas and generated files were kept together, and at any given moment I could see locally exactly what code is running on our production servers. In Prisma >=2 though, client files are in node_modules so they are not in our repositories. Obviously this makes our repos much lighter which is great, but presumably every time we make a database change, we need to not only deploy it, but then each production server needs to regenerate its client files? Now if the schema files are in source control and the version of prisma/client is pinned in package.json then the output of the file generate should be the same every time, but the fact that I can't guarantee to my boss exactly what code we have running in production, the commit hash for that code, and the test results for that commit hash makes me very uneasy. So I guess the main question is am I thinking too much about this and I should just need to add a line to our build scripts to get each app server to rebuild the client files every deploy? Or is there something I've missed?
2 replies
PPrisma
Created by Moray on 8/16/2024 in #help-and-questions
Upgrading from Prisma 1
I'm following the guide I've installed the [email protected] but when I try to run yarn prisma init to setup the new project I get "Error: Unknown binaryTarget debian-openssl-3.3.x and no custom binaries were provided". How do I proceed? I've tried installing [email protected] as suggested in this question but still get the same error. I'm running with yarn on Node 16 on EndeavourOS (Arch). I have openssl 3.3.1 package installed also.
7 replies