Skip to content

Commit

Permalink
feat: Add prisma, prisma docs, Core Unit database model (#12)
Browse files Browse the repository at this point in the history
Co-authored-by: KirillDogadin-std <[email protected]>
  • Loading branch information
BracketJohn and KirillDogadin-std authored Mar 2, 2023
1 parent 3d5bb60 commit 969bbd7
Show file tree
Hide file tree
Showing 10 changed files with 646 additions and 17 deletions.
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

0 comments on commit 969bbd7

Please sign in to comment.