This project uses a hosted database that has writes disabled. Follow these steps to set up your own demo database that lets you perform database writes:
To get your own version of this sandbox, click the Fork button in the top-left corner:
Once the forking succeeded and you have your own version of the sandbox available, you can open a new terminal tab by clicking the little + button:
The next step connects the Prisma client code in in the scripts with a fresh demo database that will be set up for you. In the terminal, run:
yarn prisma deploy
Then, follow these steps in the interactive CLI wizard:
- Select Demo server
- Open the URL that's printed by the CLI in your browser
- Authenticate with Prisma Cloud in your browser
- Back in the CodeSandbox terminal, confirm all suggested values
After prisma deploy
has terminated, the Prisma client in src/generated/prisma-client
is re-generated. This means any script you're running now will read or write data in your own demo database.
Run the following command to start exploring:
yarn demo
You can also run the scripts defined in package.json
directly, e.g.:
yarn filtering-and-sorting # executes `src/reading-data/filterting-and-sorting.ts`
IMPORTANT: Most of the scripts contain calls with hardcoded IDs (e.g. here). Once you've forked the project and connected it to your own demo database, these IDs won't be valid any more. You can run $ yarn load-ids
to print a list of the new IDs that were generated for your project and replace the hardcoded ones.