drizzle-orm icon indicating copy to clipboard operation
drizzle-orm copied to clipboard

[BUG]: `drizzle-kit up` erroring on latest [email protected] and [email protected]

Open kennyjwilli opened this issue 1 year ago • 2 comments

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 upgraded to the latest [email protected] and [email protected] this morning to make use of the excellent generated columns feature. Upon running npx drizzle-kit generate, I receive a message that snapshot.json are not of the latest version.

> pnpx drizzle-kit generate --config drizzle.config-migration.ts

drizzle-kit: v0.23.0
drizzle-orm: v0.32.0

Reading config file '/Users/kenny/work/kwllc/deeporigin/platform2/apps/nucleus-service/drizzle.config-migration.ts'
src/sql-migrations/db/meta/0000_snapshot.json/snapshot.json is not of the latest version
src/sql-migrations/db/meta/0001_snapshot.json/snapshot.json is not of the latest version
src/sql-migrations/db/meta/0002_snapshot.json/snapshot.json is not of the latest version
src/sql-migrations/db/meta/0003_snapshot.json/snapshot.json is not of the latest version
src/sql-migrations/db/meta/0004_snapshot.json/snapshot.json is not of the latest version
src/sql-migrations/db/meta/0005_snapshot.json/snapshot.json is not of the latest version
src/sql-migrations/db/meta/0006_snapshot.json/snapshot.json is not of the latest version
src/sql-migrations/db/meta/0007_snapshot.json/snapshot.json is not of the latest version
src/sql-migrations/db/meta/0008_snapshot.json/snapshot.json is not of the latest version
src/sql-migrations/db/meta/0009_snapshot.json/snapshot.json is not of the latest version
src/sql-migrations/db/meta/0010_snapshot.json/snapshot.json is not of the latest version
src/sql-migrations/db/meta/0011_snapshot.json/snapshot.json is not of the latest version
src/sql-migrations/db/meta/0012_snapshot.json/snapshot.json is not of the latest version
src/sql-migrations/db/meta/0013_snapshot.json/snapshot.json is not of the latest version
src/sql-migrations/db/meta/0014_snapshot.json/snapshot.json is not of the latest version
src/sql-migrations/db/meta/0015_snapshot.json/snapshot.json is not of the latest version
Run drizzle-kit up

The command suggests to run drizzle-kit up, so I attempt to do so. This command errors with a message stating to install the latest version of drizzle-orm.

> pnpx drizzle-kit generate
Packages: +15
+++++++++++++++
Progress: resolved 58, reused 15, downloaded 0, added 15, done
drizzle-kit: v0.23.0


Please install latest version of drizzle-orm

Expected behavior

Given I am running the latest version of drizzle-orm and drizzle-key, I would expect drizzle-kit up to work.

Environment & setup

I am running [email protected] and [email protected]. Previously, my dependencies were at [email protected] and [email protected].

> node -v
v18.17.1

kennyjwilli avatar Jul 10 '24 19:07 kennyjwilli

Thanks, I'll try to fix it asap

AndriiSherman avatar Jul 11 '24 05:07 AndriiSherman

hi i have encourented the same thing it shows me the following errors,after i typed thenpx drizzle-kit generate, i followed the tutorial to set up the schema.ts and drizzle.config.ts and db.ts file but still getting this errors : shenma@d-i89-208-249 uqcssa % npx drizzle-kit generate drizzle-kit: v0.23.0 drizzle-orm: v0.32.1

No config path provided, using default 'drizzle.config.json' /Users/shenma/Desktop/uqcssaWebsite/uqcssa/drizzle.config.json file does not exist

Yusuf-Shen avatar Jul 30 '24 12:07 Yusuf-Shen

Hello, still getting this, makes migration to new version impossible. Any advice would be highly appreciated!

gediminastub avatar Oct 22 '24 08:10 gediminastub

I am also getting this

jehns avatar Nov 02 '24 22:11 jehns

me too.

UPDATE: you need to run drizzle-kit up, which will migrate your snapshots to the upgraded format

afogel avatar Nov 10 '24 13:11 afogel

Same error (please install drizzle-orm) also happens when using pnpx drizzle-kit pull. It works when running with npx.

KrofDrakula avatar Nov 17 '24 10:11 KrofDrakula

should not be an issue on latest(0.30.0+), if it's still an issue - please reopen

AndriiSherman avatar Dec 16 '24 15:12 AndriiSherman

I'm having the same problem. "drizzle-orm": "^0.38.2", "drizzle-kit": "^0.30.1",

I managed to run drizzle-kit generate with the workaround below: npx drizzle-kit generate --config ./path/to/drizzle.config.ts

leonardoee avatar Dec 24 '24 03:12 leonardoee

https://github.com/drizzle-team/drizzle-orm/issues/2614 https://github.com/drizzle-team/drizzle-orm/issues/2699 https://github.com/drizzle-team/drizzle-orm/issues/3248 https://github.com/drizzle-team/drizzle-orm/issues/3578 https://github.com/drizzle-team/drizzle-orm/issues/3934

All these are somehow related: when a user is setup with npm workspaces (monorepo), sometimes drizzle-kit is hoisted and drizzle-orm is not. Depending on the versions, sometimes both get hoisted and it works. Currently, I have these two versions working OK (as both get hoisted):

    "drizzle-kit": "0.30.4",
    "drizzle-orm": "0.39.0",

If i was to update drizzle-orm to 0.39.0, it would no longer hoist it and drizzle-kit would come up with the dreaded: Please install latest version of drizzle-orm.

The trigger is this block which throws because await import('drizzle-orm/version') doesn't find drizzle-orm.

$ node -v
v22.13.1
$ npm -v
10.9.2

akmoulai avatar Feb 01 '25 16:02 akmoulai