drizzle-orm
drizzle-orm copied to clipboard
[BUG]: TypeError: movedTables is not iterable
What version of drizzle-orm are you using?
"^0.32.0"
What version of drizzle-kit are you using?
"^0.23.0"
Describe the Bug
I ran introspect command and following were the error
bunx drizzle-kit introspect drizzle-kit: v0.23.0 drizzle-orm: v0.32.0
No config path provided, using default path Reading config file '/Users/some_dirs/drizzle.config.ts' Pulling from ['product'] list of schemas
Using 'pg' driver for database querying [✓] 192 tables fetched [✓] 1074 columns fetched [✓] 0 enums fetched [✓] 0 indexes fetched [✓] 285 foreign keys fetched
TypeError: movedTables is not iterable
at applyPgSnapshotsDiff (/Users/some_dirs/node_modules/drizzle-kit/bin.cjs:29346:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async introspectPostgres (/Users/some_dirs/node_modules/drizzle-kit/bin.cjs:126156:42)
at async _Command.
And the following warnings/errors were shown in the vscode Cannot find name 'nextval'. Cannot find name 'regclass'.
export const resource = our_schema.table("resource", { resource_id: uuid("resource_id"), clicked_at: date("clicked_at").defaultNow(), clicker_ip: varchar("clicker_ip"), clicked_by: varchar("clicked_by"), id: integer("id").default(nextval('ourschema.social_clicks_id_seq'::regclass)).notNull(), });
Expected behavior
No response
Environment & setup
No response
I'm having the same issue
❯ npx drizzle-kit introspect
drizzle-kit: v0.23.0
drizzle-orm: v0.32.0
No config path provided, using default path
Reading config file '/Users/redacted/Documents/workspace/redacted/drizzle.config.ts'
Pulling from ['public'] list of schemas
Using 'pg' driver for database querying
[✓] 8 tables fetched
[✓] 46 columns fetched
[✓] 0 enums fetched
[✓] 0 indexes fetched
[✓] 11 foreign keys fetched
TypeError: movedTables is not iterable
at applyPgSnapshotsDiff (/Users/redacted/Documents/workspace/redacted/node_modules/drizzle-kit/bin.cjs:29346:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async introspectPostgres (/Users/redacted/Documents/workspace/redacted/node_modules/drizzle-kit/bin.cjs:126156:42)
at async _Command.<anonymous> (/Users/redacted/Documents/workspace/redacted/node_modules/drizzle-kit/bin.cjs:131714:7)
I did notice that the drizzle/relations.ts, drizzle/schema.ts and meta/_journal.json were created and appear to be correct however.
I also having the same issue
$ npx drizzle-kit introspect drizzle-kit: v0.23.0 drizzle-orm: v0.32.0
No config path provided, using default path Reading config file 'C:\Users\Admin\Desktop\Evitamin\am484\evitstool_full\drizzle.config.ts' Pulling from ['public'] list of schemas
Using 'pg' driver for database querying [✓] 339 tables fetched [✓] 13792 columns fetched [✓] 16 enums fetched [✓] 68 indexes fetched [✓] 1586579 foreign keys fetched
TypeError: movedTables is not iterable
at applyPgSnapshotsDiff (C:\Users\Admin\Desktop\Evitamin\am484\evitstool_full\node_modules.pnpm\[email protected]\node_modules\drizzle-kit\bin.cjs:29346:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async introspectPostgres (C:\Users\Admin\Desktop\Evitamin\am484\evitstool_full\node_modules.pnpm\[email protected]\node_modules\drizzle-kit\bin.cjs:126156:42)
at async _Command.
drizzle-kit: v0.23.0 drizzle-orm: v0.32.0
No config path provided, using default path Reading config file '/Users/cristonmascarenhas/Documents/projects/trail-backend/drizzle.config.ts' Pulling from ['public'] list of schemas
Using 'pg' driver for database querying [✓] 19 tables fetched [✓] 109 columns fetched [✓] 2 enums fetched [✓] 0 indexes fetched [✓] 14 foreign keys fetched
TypeError: movedTables is not iterable
at applyPgSnapshotsDiff (/Users/cristonmascarenhas/Documents/projects/trail-backend/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:29346:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async introspectPostgres (/Users/cristonmascarenhas/Documents/projects/trail-backend/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:126156:42)
at async _Command.
Same error with drizzle-kit introspect with the latest version.
This is one of the first steps when we migrate from Prisma to Drizzle.
Same problem here
I run the same problem after upgrading the drizzle-orm version.
I fixed it by manually updating themigrations/meta/_journal.json file from
{
"version": "5",
"dialect": "pg",
...
}
to
{
"version": "7",
"dialect": "postgresql",
...
}
Maybe the command drizzle-kit up can help
Same error with
drizzle-kit introspectwith the latest version.This is one of the first steps when we migrate from Prisma to Drizzle.
Same here. I want to generate a schema.ts file using introspect.
Same issue on latest version of drizzle/drizzle-kit
Even I am facing the same error.
Having the same issue
Ditto here
Same here
Same
I directly edited bin.cjs inside my node_modules to check if movedTables is declared.
OBS: I don't know if this is right, but I was able to generate the schema based on the schemas that were already present in my Postgres.
Code:
This issue is reproducible for me in drizzle-kit version 0.23.0, 0.23.0-03c18d1 and 0.23.0-21045a0 but does not occur in version 0.22.8 or 0.22.9-92953ac. So downgrading the version is a temporary workaround.
In all my tests drizzle-orm is on version 0.32.0 (i guess drizzle-orm is not used in this process?).
This issue is reproducible for me in
drizzle-kitversion0.23.0,0.23.0-03c18d1and0.23.0-21045a0but does not occur in version0.22.8or0.22.9-92953ac. So downgrading the version is a temporary workaround. In all my testsdrizzle-ormis on version0.32.0(i guessdrizzle-ormis not used in this process?).
this fixed it for me too
Having the same issue
drizzle-kit: v0.23.0 drizzle-orm: v0.32.1
No config path provided, using default path Reading config file '/Users/elihirwa/Desktop/Development/BAG/Projects/bag-app/drizzle.config.ts' Pulling from ['public'] list of schemas
Using 'pg' driver for database querying
[✓] 93 tables fetched
[✓] 641 columns fetched
[✓] 0 enums fetched
[✓] 1 indexes fetched
[✓] 151 foreign keys fetched
TypeError: movedTables is not iterable
at applyPgSnapshotsDiff (/Users/elihirwa/Desktop/Development/BAG/Projects/bag-app/node_modules/drizzle-kit/bin.cjs:29346:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async introspectPostgres (/Users/elihirwa/Desktop/Development/BAG/Projects/bag-app/node_modules/drizzle-kit/bin.cjs:126156:42)
at async _Command.<anonymous> (/Users/elihirwa/Desktop/Development/BAG/Projects/bag-app/node_modules/drizzle-kit/bin.cjs:131714:7)
✨ Done in 135.54s.
Same here
PLEASE FIX IT BUDDY T__T
https://github.com/drizzle-team/drizzle-orm/issues/2618#issuecomment-2241788331
this worked for me
Same
This issue is reproducible for me in
drizzle-kitversion0.23.0,0.23.0-03c18d1and0.23.0-21045a0but does not occur in version0.22.8or0.22.9-92953ac. So downgrading the version is a temporary workaround. In all my testsdrizzle-ormis on version0.32.0(i guessdrizzle-ormis not used in this process?).
Worked amazingly for me as well
do you see it on 0.24.0 version of drizzle-kit? Trying to reproduce it there, but no luck
Can anyone provide a repo where the bug can be reproduced? Will greatly help in solving this issue.
Hey everyone!
I've created this message to send in a batch to all opened issues we have, just because there are a lot of them and I want to update all of you with our current work, why issues are not responded to, and the amount of work that has been done by our team over ~8 months.
I saw a lot of issues with suggestions on how to fix something while we were not responding – so thanks everyone. Also, thanks to everyone patiently waiting for a response from us and continuing to use Drizzle!
We currently have 4 major branches with a lot of work done. Each branch was handled by different devs and teams to make sure we could make all the changes in parallel.
First branch is drizzle-kit rewrite
All of the work can be found on the alternation-engine branch. Here is a PR with the work done: https://github.com/drizzle-team/drizzle-orm/pull/4439
As you can see, it has 167k added lines of code and 67k removed, which means we've completely rewritten the drizzle-kit alternation engine, the way we handle diffs for each dialect, together with expanding our test suite from 600 tests to ~9k test units for all different types of actions you can do with kit. More importantly, we changed the migration folder structure and made commutative migrations, so you won't face complex conflicts on migrations when working in a team.
What's left here:
- We are finishing handling defaults for Postgres, the last being geometry (yes, we fixed the
sridissue here as well). - We are finishing commutative migrations for all dialects.
- We are finishing up the command, so the migration flow will be as simple as
drizzle-kit upfor you.
Where it brings us:
- We are getting drizzle-kit into a new good shape where we can call it
[email protected]!
Timeline:
- We need ~2 weeks to finish all of the above and send this branch to beta for testing.
Second big branch is a complex one with several HUGE updates
- Bringing Relational Queries v2 finally live. We've done a lot of work here to actually make it faster than RQBv1 and much better from a DX point of view. But in implementing it, we had to make another big rewrite, so we completely rewrote the drizzle-orm type system, which made it much simpler and improved type performance by ~21.4x:
(types instantiations for 3300 lines production drizzle schema + 990 lines relations)
TS v5.8.3: 728.8k -> 34.1k
TS v5.9.2: 553.7k -> 25.4k
You can read more about it here.
What's left here:
- We have 1 issue with TS that is already in progress of being fixed. The issue and Post about fixing.
Where it brings us:
- We are getting drizzle-orm into a new good shape where we can call it
[email protected]!
Breaking changes:
- We will have them, but we will have open channels for everyone building on top of drizzle types, so we can guide you through all the changes.
Third branch is adding support for CockroachDB and MSSQL dialects
Support for them is already in the alternation-engine branch and will be available together with the drizzle-kit rewrite.
Summary
All of the work we are doing is crucial and should be done sooner rather than later. We've received a lot of feedback and worked really hard to find the best strategies and decisions for API, DX, architecture, etc., so we can confidently mark it as v1 and be sure we can improve it and remain flexible for all the features you are asking for, while becoming even better for everyone building on top of the drizzle API as well.
We didn't want to stay with some legacy decisions and solutions we had, and instead wanted to shape Drizzle in a way that will be best looking ahead to 2025–2026 trends (v1 will get proper effect support, etc.).
We believe that all of the effort we've put in will boost Drizzle and benefit everyone using it.
Thanks everyone, as we said, we are here to stay for a long time to build a great tool together!
Timelines
We are hoping to get v1 for drizzle in beta this fall and same timeline for latest. Right after that we can go through all of the issues and PRs and resond everyone. v1 for drizzle should close ~70% of all the bug tickets we have, so on beta release we will start marking them as closed!