This doc seems like a long one, but it's not too hard to do. You'll do it even faster once you get the hang of it. Treat this document like a map that will help you get to your destination -- i.e., feel free to explore surrounding territory should your heart desire, this doc is only a helpful guide.
- Create empty tests that are filled only with comments that describe how the test will work. These tests dont do anything right now, but you'll fill them up later with working code.
- Create a migration by copy-pasting an old one. Make sure the
downmethod refers to the new table. - Create a new entry in
database.d.ts - Create a Repo file in
src/data. Follow existing patterns. Note: If you need any complex logic beyond request parsing and database querying, that would go inside asrc/service/*file. (HINT: At this point, you can go and fill in more of your unit tests.) - Create a Factory to create fake data inside
dev/data/factories - Add your entity to
datasetFactoryin a way that makes sense for your code. - Add your entity to
datasetGeneratorwhich will generate complex datasets for our use. Provide thedatasetFactoryparameters in a way that makes sense for your new entity. - Add your entity to
datasetLoaderwhich will load up datasets by name into our database. - Now you want to generate new data to update the
dev/test/datasetfolder with your new entity. These are used across all of our unit tests and are also loaded up as dev data. After modifyingdatasetGeneratorin the previous steps, you can use theyarn dev:generate-datasetcommand to generate a dataset automatically. Your datasets will be replaced automatically. - At this point, you can go and fill in all of your tests completely. Do this first so that you can have failing tests before you go and create Schemas.
- Create a Schema for your new entity in
src/schemasand make all the necessary joins on the schema level. - At this point, you want to build-test-fix against your unit tests until your tests pass.