Is your feature request related to a problem? Please describe.
We currently don't have a high level way to seed databases with groups, or taxonomy data.
Describe the solution you'd like
A seed system that consumes a GraphQL seed file. Should be runnable using a mix command. Should be idempotent and not return an error code when run repeatedly.
front-end devs will see the UI in a state that better reflects what actual users see when they use the app and have data to work with that provides verisimilitude
back-end devs will have data to work with that provides verisimilitude
database seeding will exercise the app's creation API, making it much less likely to seed with malformed data
Describe alternatives you've considered
We had a seed script at development/seed-test-group.sh. This script is written in shell and runs psql to add a single row to the groups table.
How we may solve this
Add a new module Mix.Tasks.Ferry.Seed that uses Mix.Task macro
This task should support the following arguments:
feed url (starting with https://, otherwise we assume it is a local path in the filesystem).
We could also support s3:// and pull data from an existing S3 bucket in AWS.
target endpoint (the uri of the target toolbox server. By default, this would be http://localhost:1312.
an auth token
The task should return a user friendly error if:
the feed url could not be read as as text
the toolbox graphql endpoint is not reachable
the auth token is not given or not valid.
The task should execute the graphql document against the toolbox endpoint.
It should print the GraphQL obtained in the response to standard output, and exit normally.
We should write unit tests against this mix task, in order to keep code coverage high in the project.
Is your feature request related to a problem? Please describe.
We currently don't have a high level way to seed databases with groups, or taxonomy data.
Describe the solution you'd like
A seed system that consumes a GraphQL seed file. Should be runnable using a mix command. Should be idempotent and not return an error code when run repeatedly.
Describe alternatives you've considered
We had a seed script at
development/seed-test-group.sh
. This script is written in shell and runs psql to add a single row to thegroups
table.How we may solve this
Add a new module
Mix.Tasks.Ferry.Seed
that usesMix.Task
macroThis task should support the following arguments:
https://
, otherwise we assume it is a local path in the filesystem).s3://
and pull data from an existing S3 bucket in AWS.http://localhost:1312
.The task should return a user friendly error if:
The task should execute the graphql document against the toolbox endpoint.
It should print the GraphQL obtained in the response to standard output, and exit normally.
We should write unit tests against this mix task, in order to keep code coverage high in the project.
Additional context