-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Telescope Prisma docs #3503
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, thanks for this.
|
||
```bash | ||
cd src/db | ||
cp env.example .env |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we don't have a way to run migrations on the remote DB.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it should be possible to have INSERT
statements in the migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all migrations will be included. To seed the DB, people often run a script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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