drizzle-team / drizzle-orm

Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅
https://orm.drizzle.team
Apache License 2.0
23.53k stars 577 forks source link

[BUG]: Renaming Tables errors out on Turso #1044

Closed lightyaer closed 1 year ago

lightyaer commented 1 year ago

What version of drizzle-orm are you using?

0.28.2

What version of drizzle-kit are you using?

0.19.12

Describe the Bug

While planning schema, had to rename a few tables, and encountered this error. On turso db, while running drizzle-kit push:sqlite

Screenshot 2023-08-13 at 9 24 44 PM

Expected behavior

The command drizzle-kit push:sqlite to work flawlessly.

Environment & setup

On my local machine, with a remote turso db.

AndriiSherman commented 1 year ago

Just found an issue. Fixing that

AndriiSherman commented 1 year ago

Just to double-check, did you make any other changes besides renaming?

lightyaer commented 1 year ago

Nope, just the renaming changes, as seen in the image. plural to singular naming convention.

AndriiSherman commented 1 year ago

should be fixed in drizzle-kit@0.19.13

lightyaer commented 1 year ago

@AndriiSherman, I maybe wrong on just the renaming changes,

This still happens on drizzle-kit@0.19.13, I get the same error.

Now, that there are 4 tables in db, device, log, space & user (user wasn't renamed, hence it didn't appear in the first comment).

I also deleted the migrations folder(I know I shouldn't have done this, but this is a dummy project),

Now, when I remove all tables from schema.ts except user, I still get the same columns of undefined error.

Screenshot 2023-08-28 at 12 06 15 AM

Humble Suggestion: Maybe, we could look into introspecting the db before pushing, if thats not too much, and have it display the conflicts/errors, instead of columns of undefined error.

Let me know, If this can be a good-first-issue, I can offer some help, or maybe guide me into fixing this.