Add Telescope Prisma docs#3503
Conversation
humphd
left a comment
There was a problem hiding this comment.
Excellent, thanks for this.
|
|
||
| ```bash | ||
| cd src/db | ||
| cp env.example .env |
There was a problem hiding this comment.
Question: should we default to this somehow vs. making it a requirement? That is, do we ever need to change the values in this file? If not, maybe we should hard-code it into the script.
There was a problem hiding this comment.
Yeah, we don't have a way to run migrations on the remote DB.
There was a problem hiding this comment.
Can we hardcode the DATABASE_URL if the DB password on dev and production are different?
|
|
||
| ### Custom migration | ||
|
|
||
| Sometimes, we want to make changes other than the modifying the schema, for example, adding new RLS to a table. We can do so by creating an empty migration file, which is an empty SQL script where we write our own SQL queries to be apply to the database. |
There was a problem hiding this comment.
Can we use this to somehow include a migration for setting up the local db, but not run it by default in any environment other than dev?
I want to insert a user + feed based on #3501
There was a problem hiding this comment.
Yeah, I think it should be possible to have INSERT statements in the migration.
There was a problem hiding this comment.
I think all migrations will be included. To seed the DB, people often run a script.
There was a problem hiding this comment.
OK, so we need to do this outside of migrations. We'll have to think about how to do it best, so we don't do it in tests, and we don't rely on users to do it locally (new users won't, it will be annoying to do it every time for regular devs).
There was a problem hiding this comment.
I'm thinking of putting the seed script can be src/db, making it read from a JSON file containing the example data. We call the script in pnpm services:start.
Issue This PR Addresses
Write docs to Manage DB with Prisma
Type of Change
Description
Steps to test the PR
Checklist