Skip to content
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 prisma #12

Merged
merged 3 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Prisma environment variables
DATABASE_URL="file:./db.sqlite"
17 changes: 15 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
{
// From: https://github.com/airbnb/javascript/issues/451 - we want airbnb, but not it's react rules (because we don't use react)
"extends": "airbnb-base",
"extends": [
"airbnb-base",
"airbnb-typescript/base"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": [
"@typescript-eslint"
],
"root": true,
"overrides": [
{
"files": [
Expand All @@ -24,6 +35,8 @@
"rules": {
"no-return-await": [
"error"
]
],
"import/prefer-default-export": "off"
}
}

Binary file added .github/app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@

Open-source API over database models made to be developer- and analyst-friendly.

![app](./.github/app.png)

## Development

We use TypeScript, JavaScript and Node 18 (LTS) to develop this project. Commands:
```sh
# Set the required environment variables
cp .env.development .env

# Install all required dependencies
npm i

Expand Down Expand Up @@ -41,3 +46,18 @@ To understand bettwe that is planned, you can read and ask questions here:
- Document Model explanation: https://github.com/makerdao-ses/switchboard-boilerplate/issues/1

This covers the current idea of what we strive to achieve in a first phase.


## Database

We use [Prisma ORM](prisma.io/) as an ORM for this project. It is installed when you run `npm i`. Here are some useful commands for development:
```sh
# Push the current database schema to the database. This will also automatically generate the prisma client
npx prisma db push

# Create the typescript database client from the `schema.prisma` file
npx prisma generate

# Get a live-view of the database, useful for development and testing
npx prisma studio
```
14 changes: 0 additions & 14 deletions index.ts

This file was deleted.

Loading