Comments (8)
@daniel-nagy @hilja I just patched the import logic to determine based on the project's moduleResolution, let me know if it's not working
It breaks on my repo π
I couldn't find any better approach, so I just provide the config to override
from prisma-generator-drizzle.
Ah, this won't work drizzle-team/drizzle-orm#849 I ran the generator yesterday evening and didn't try to migrate until this morning and noticed it can't find the tables.
from prisma-generator-drizzle.
This is the way:
"scripts": {
"generate": "NODE_OPTIONS='--import tsx' drizzle-kit generate:pg"
}
A bit off-topic but, is the following supposed to work?
export default defineConfig({
schema: './drizzle/schema/schema.ts',
})
It can't find any tables from the schema.ts
, but glob works fine :)
export default defineConfig({
schema: './drizzle/schema/*',
})
from prisma-generator-drizzle.
@hilja do you mind making a repository where I can reproduce the issue?
So far I'm importing the generated models in a next.js project (using the tsconfig created from create-next-app
) and a simple ts project works fine
from prisma-generator-drizzle.
Here's a quick repro:
The app I was testing with is loosely based on the epic stack https://github.com/epicweb-dev/epic-stack
So I hacked up prisma-generator-drizzle in there https://github.com/hilja/drizzle-test. Note that the app won't actually work because I used postgres (epic-stack is sqlite). But the generator should.
Setup:
git clone [email protected]:hilja/drizzle-test.git
cd drizzle-test
npm i
npm prisma generate
After generating the drizzle schema, the imports in prisma/drizzle/schema
should error: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'.
Adding .ts
or .js
manually fixes it.
And when trying to drizzle-kit generate:pg
with npm run generate
, it canβt find any tables:
0 tables
No schema changes, nothing to migrate π΄
from prisma-generator-drizzle.
I have the same issue. To make things easy I believe this library could just always add the .js
extension to the import path. I believe that would work in all cases but I could be wrong.
from prisma-generator-drizzle.
I just opened a PR to add the js extension. @hilja as a temporary workaround you can use my fork by installing it from a git URL.
yarn add daniel-nagy/prisma-generator-drizzle#js-ext-pkg
from prisma-generator-drizzle.
@daniel-nagy @hilja I just patched the import logic to determine based on the project's moduleResolution, let me know if it's not working
from prisma-generator-drizzle.
Related Issues (11)
- v1 HOT 23
- Circular dependency on generated schema HOT 3
- Support for @ignore and @@ignore HOT 3
- Option to suppress generator output? HOT 1
- Re-export all the models in the schema file HOT 3
- Provide default export for all schema HOT 2
- Respect default values in timestamps/dates HOT 1
- Error: There is not enough information to infer relation... HOT 14
- Postgres TimestampTZ is generated without withTimezone:true HOT 1
- Cockroachdb provider support (same as postgres) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prisma-generator-drizzle.