Skip to content

Add Telescope Prisma docs#3503

Merged
DukeManh merged 2 commits into
Seneca-CDOT:masterfrom
DukeManh:prisma-docs
Apr 17, 2022
Merged

Add Telescope Prisma docs#3503
DukeManh merged 2 commits into
Seneca-CDOT:masterfrom
DukeManh:prisma-docs

Conversation

@DukeManh

@DukeManh DukeManh commented Apr 16, 2022

Copy link
Copy Markdown
Contributor

Issue This PR Addresses

Write docs to Manage DB with Prisma

Type of Change

  • Bugfix: Change which fixes an issue
  • New Feature: Change which adds functionality
  • Documentation Update: Change which improves documentation
  • UI: Change which improves UI

Description

Steps to test the PR

Checklist

  • Quality: This PR builds and passes our npm test and works locally
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not (if applicable)
  • Documentation: This PR includes updated/added documentation to user exposed functionality or configuration variables are added/changed or an explanation of why it does not(if applicable)

@gitpod-io

gitpod-io Bot commented Apr 16, 2022

Copy link
Copy Markdown

Comment thread src/web/docusaurus/docs/tools-and-technologies/prisma.md Outdated
Comment thread src/web/docusaurus/docs/tools-and-technologies/prisma.md Outdated
tcvan0707
tcvan0707 previously approved these changes Apr 17, 2022

@humphd humphd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, thanks for this.

Comment thread src/web/docusaurus/docs/tools-and-technologies/prisma.md Outdated
Comment thread src/web/docusaurus/docs/tools-and-technologies/prisma.md

```bash
cd src/db
cp env.example .env

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor Author

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?

Comment thread src/web/docusaurus/docs/tools-and-technologies/prisma.md Outdated

### 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.

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor

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).

Copy link
Copy Markdown
Contributor Author

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.

Comment thread src/web/docusaurus/docs/tools-and-technologies/prisma.md Outdated
Comment thread src/web/docusaurus/docs/tools-and-technologies/prisma.md Outdated
@DukeManh DukeManh merged commit e333de1 into Seneca-CDOT:master Apr 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: documentation (docs) Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants