GhostBobG
Convex Community17mo ago
19 replies
GhostBob

Seeding DB from command line...

The goal is to seed the database (containing a table called "users") with a pre-defined global admin user. Email and password are taken from environment variables.

On the local machine, I have a .env.local file. The content of this file is also added to convex project settings in the cloud.

Created "seed" internalAction which uses node environment.
This seed action is calling internalQuery "get" which checks if the user exists in the db and if not, I'm calling "add" internalMutation.

How should I call my internalAction to seed the db?

Calling in the terminal following commands result in zero data in database:
npx convex run seed
npx convex run dbSeed:seed
npx convex run dbSeed.seed

How do I call seed internalAction from cli?
image.png
image.png
Was this page helpful?