I’ve followed the tutorial and browsed the example-blog in the RedwoodJS repo. I’ve seeded my app locally with yarn rw db seed
, but I’m wondering how I could run a similar command in production.
Thanks!
I’ve followed the tutorial and browsed the example-blog in the RedwoodJS repo. I’ve seeded my app locally with yarn rw db seed
, but I’m wondering how I could run a similar command in production.
Thanks!
I can think of two ways to do this today (we’ll probably come up with a more Redwood-way eventually):
netlify.toml
you’ll see the commands that run to build the site. You could add a && yarn rw db seed
in there, to make the line: yarn rw db up --no-db-client && yarn rw db seed && yarn rw build
If you go this path just make sure that your seeds are idempotent, meaning you can run them on every deploy and not have anything bad happen (like create a new Admin user every time), or make sure you take that line out of netlify.toml
after you deploy the first time!
Update
As of RedwoodJS version >=0.25.0
the seed command has been replaced with yarn rw prisma db seed
.
Patch notes: Release v0.25.0 · redwoodjs/redwood · GitHub
Prisma cli in Redwood: Docs - CLI Commands : RedwoodJS Docs