Get issue trying to run libsql/turso example
on this project https://github.com/learn-anything/learn-anything/tree/main/db
If I run
pnpm run start
, I get this:GitHub
learn-anything/db at main · learn-anything/learn-anything
Organize world's knowledge, explore connections and curate learning paths - learn-anything/db at main · learn-anything/learn-anything

79 Replies
cc @Dan Kochetov
are you trying to import something from
drizzle-orm/expressions
?not directly
its the turso/libsql example
i just changed schema
instead of
posts
its topics
did not do any new imports
ok see this
but i did not add it
an outdated example probably
this should be imported from
drizzle-orm

get this now
i guess it tries to run migration again

im very confused why it thinks its outdated
i guess it takes a global one
i dont get on which line this error happens
table topics already exists
🤔drizzle-kit latest is 0.19.2
Not 0.18.0


im so confused
drizzle-orm is in node_modules no?

its on
latest
but drizzle-kit fails to recognise it
it would be nice if the
drizzle-kit
was standalone
and didn't depend on external things
because I don't know where it is getting drizzle-orm from, it should be latest version in node_modules
but its failing
dont know how to fix it
tried rm -rf node_modules
and pnpm i
too
or maybe im missing something
pnpm add -g drizzle-orm
ok it has a dep on global drizzle-ormi thought generate would fix it

yea i dont know what throws this error
trying to read through the turso/libsql example I guess it tries to create the table
it feels like its trying to run migrations that it already run
going to seed the db for now, not really sure how to preceed from the error
maybe delete all the migrations files and start again? 🤔
it could be applied migration manually myself?
as it was not working for me
not sure how to reset things
from the error it seems its libsql
i mentioned it in turso discord
i don't really know how to unblock from this
i can try wipe migrations and run start again
Do .tables
Tables already exist?
The SQLite generated output should use IF NOT EXISTS

this is prod that drizzle connects to

is it safe to delete the 3 migrations?

one of the migrations doesn't even have any sql inside



or i should just modify this one migration and delete the other 2
ok i did that
modified this too


im either extremely unlucky or i dont get drizzle
ok this works at least, no idea why package.json scripts use old versions, so weird

still getting this

dont get why

stack trace does not say the line
i assume its during
migrate
like why would it try create topics
table
The SQLite generated output should use IF NOT EXISTS@alcaponeyou where should I add this?

did not solve it
i dont actually get why i got another migration
like its just duplicated

seems drizzle is confused
drizzle should have aded that but it doesn't
add "verbose: true" in your drizzle.confg.ts file

so i did this
still fails

drop your tables
shell into your turso instance
drop table users;
and topics
then rerun
can i start fresh
like no migrations

i.e. i removed migrations folder now
so i want a fresh schema deployed
drizzle-kit generate:sqlite
so I can run this now?

i guess i need to db-push it now?
how can i do it
you need to use migrate() function from drizzle-orm
remove __drizzle_migrations also

before running migrations from scratch
its there
but i cant run it
it fails on some sql

how do i remove
__drizzle_migrations
i thought i can drop table it
oh ok that worked
so yes cant run the server
GitHub
learn-anything/db at main · learn-anything/learn-anything
Organize world's knowledge, explore connections and curate learning paths - learn-anything/db at main · learn-anything/learn-anything
is code i have
just remove migrations folder
generate everything from scratch
and it will work
done


i need to db-push it i think
to turso
db push has nothing with generate process

i gave right credentials in .env
db push will push schema directly to the database
so it should apply it to prod turso
but it doesnt
ok so
drizzle-kit generate:sqlite
only changed schema to local sqlite?
shouldnt it be prod turso
as i have provided the url and auth tokenit's nor changing schema
it;s just generating an sql migration file
you need to apply it to database then
using migrate() function

oh ok that worked
thank god
thank you @Andrew Sherman
great