Hi all! Wanted to gather some ideas from the community:
1. Has anyone had some thoughts on how to “seed” prod dbs, as part of migrations?
I know you can use rw db seed, but this feels more like for local dev. Ideally I was looking for something like the rails up in the migration file
2. How do you guys handle error codes from graphql?
Is there an apollo-ific way to do this instead of digging into the error response like (yuck!)
I haven’t done a retry in a Cell, but I have done so in a function that calls a service that then a 3rd party external API to deal with 503 rate limits or other errors that this external API can return … and I like the “exponential backoff” approach.
The “unintuitive” bit I see is that, while the <Error/> component has access to the query in cells, there isn’t an obvious way to call this query in there. i.e. there isn’t a cookbook way of doing it, while its a very common usecase.
I’d do the retry in the service that the cell calls.
That way the Loading will wait wait wait and then if it finally errors after the max tries is exceeded, it’ll throw an error for the Error in cell to handle.
Or if it succeeds eventually, Success would be used.
Yes, Data Migrations are here! You’ll be able to write migrations to database content with Data Migrations in a similar manner to database structure changes via Prisma Migrate.
There are three commands to know:
yarn rw dataMigrate install
This adds the needed database table for tracking which data migrations have already run to your schema.prisma file, and creates a directory for data migrations to live in.
yarn rw g dataMigration yourNameHere
Creates a new data migration file with a timestamp in the name. These go in api/prisma/dataMigrations
yarn rw dataMigrate up
Runs any outstanding data migrations against the database!