#db:generate does nothing
16 messages · Page 1 of 1 (latest)
It also creates a new snapshot file with the content:
{
"tables": [],
"namespaces": []
}
It doesn’t work for a specific module, but it doesn’t throw any exceptions.
try npx medusa db:generate (specificModule).
npx medusa db:generate (specificModule)
I’m doing exactly that.
it's only going to compare current model code to db, if there is no difference no migrations generated.
There are no tables in the database. I’ve dropped them.
then run npx medusa db:migrate
It doesn’t do anything because db:generate doesn’t generate the correct migration files. It thinks the tables are still present and displays Skipped. Database is up-to-date for module
if you've dropped all tables, npx medusa db:migrate recreates them all against in the db.
double check you're connecting to the correct db
npx medusa db:migrate will recreate all tables ONLY if the migrations are generated beforehand. However, npx medusa db:generate [specificModule] currently doesn’t create the necessary migrations, that’s the main issue here.
packages/core/utils/src/modules-sdk/migration-scripts/migration-generate.ts
method buildGenerateMigrationScript get empty models array
packages/core/modules-sdk/src/loaders/utils/load-internal.ts line 448