diff --git a/README.md b/README.md index d2fd586e..e1940fea 100755 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ A RESTful API for Pokémon - [pokeapi.co](https://pokeapi.co) make setup ``` -- Run the server using the following command: +- Run the server on port `8000` using the following command: ```sh make serve @@ -45,25 +45,34 @@ A RESTful API for Pokémon - [pokeapi.co](https://pokeapi.co) ### Database setup +To build or rebuild the database by applying any CSV file update, run + ```sh make build-db ``` Visit [localhost:80/api/v2/](localhost:80/api/v2/) to see the running API! -Each time the build script is run, it will iterate over each table in the database, wipe it, and rewrite each row using the data found in data/v2/csv. - -The option to build individual portions of the database was removed in order to increase performance of the build script. +Each time the `build-db` script is run, it will iterate over each table in the database, wipe it, and rewrite each row using the data found in data/v2/csv. If you ever need to wipe the database use this command: ```sh -make wipe_db +make wipe-sqlite-db ``` +If the database schema has changed, generate any outstanding migrations and apply them + +```sh +make make-migrations +make migrate +``` + +Run `make help` to see all tasks. + ## Docker and Compose   [![docker hub](https://img.shields.io/docker/v/pokeapi/pokeapi?label=tag&sort=semver)](https://hub.docker.com/r/pokeapi/pokeapi) -There is also a multi-container setup, managed by [Docker Compose](https://docs.docker.com/compose/). This setup allows you to deploy a production-like environment, with separate containers for each services and is recommended if you need to simply spin up PokéAPI. +There is also a multi-container setup, managed by [Docker Compose](https://docs.docker.com/compose/). This setup allows you to deploy a production-like environment, with separate containers for each service, and is recommended if you need to simply spin up PokéAPI. Start everything by @@ -81,6 +90,19 @@ docker-compose exec -T app sh -c 'echo "from data.v2.build import build_all; bui Browse [localhost/api/v2/](http://localhost/api/v2/) or [localhost/api/v2/pokemon/bulbasaur/](http://localhost/api/v2/pokemon/bulbasaur/) on port `80`. +To rebuild the database and apply any CSV file updates, run + +```sh +make docker-build-db +``` + +If the database schema has changed, generate the migrations and apply those + +```sh +make docker-make-migrations +make docker-migrate +``` + ## GraphQL   When you start PokéAPI with the above docker-compose setup, an [Hasura Engine](https://github.com/hasura/graphql-engine) server is started as well. It's possible to track all the PokeAPI tables and foreign keys by simply @@ -95,7 +117,7 @@ When finished browse http://localhost:8080 and you will find the admin console. A free public GraphiQL console is browsable at the address https://beta.pokeapi.co/graphql/console/. The relative GraphQL endpoint is accessible at https://beta.pokeapi.co/graphql/v1beta -A set of examples are provided in the directory [/graphql/examples](./graphql/examples) of this repository. +A set of examples is provided in the directory [/graphql/examples](./graphql/examples) of this repository. ## Kubernetes   [![k8s status](https://github.com/PokeAPI/pokeapi/actions/workflows/kustomize.yml/badge.svg?branch=master)](https://github.com/PokeAPI/pokeapi/actions/workflows/kustomize.yml) @@ -171,7 +193,7 @@ This project exists thanks to all the people who [contribute](https://github.com -All contributions are welcome: bug fixes, data contributions, recommendations. +All contributions are welcome: bug fixes, data contributions, and recommendations. Please see the [issues on GitHub](https://github.com/PokeAPI/pokeapi/issues) before you submit a pull request or raise an issue, someone else might have beat you to it.