teable/packages/db-main-prisma
Mike 5cf73f2c3e
feat: support record comment (#910)
* feat: comment backend initialize

* feat: comment openapi initialize

* feat: support comment reaction and notify

* chore: expose `HoverPortal` component

* chore: update `@teable/icons`

* feat: create comment prisma tempalte

* feat: generate comment open-api

* feat: support comment advance feature

* feat: comment notify user list add quote creator and mention user

* feat: grid support display comment count

* chore: add comment e2e test suit

* fix: fix type definition clash

* chore: add comment migration

* fix: separate partial comment type definition for zod2openapi unknown error

* fix: import `@teable/icons` error when `moduleResolution` set to `Bundler`

* fix: sdk i18n error code

* feat: rename comment subscribe table name and generate migration

* feat: add comment reaction thumbsdown

* fix: add presence unsubscribe judgment relative to comment

* chore: css adjustment

fix: zod2openapi error by separate type define

* fix: comment e2e error

* feat: add composite index for comment list table

* feat: add record comment count query api

* fix: reply to someone should be receive the notification

* fix: comment count inaccurate when add view group condition

* fix: abundant field expand card display

* feat: @ mention user filter self

* fix: not found subscribe throw null
2024-09-20 11:07:20 +08:00
..
prisma feat: support record comment (#910) 2024-09-20 11:07:20 +08:00
src feat: dashboard (#860) 2024-09-18 12:15:23 +08:00
.eslintrc.cjs chore: rename (#356) 2024-01-30 22:20:05 +08:00
.gitignore feat: add sqlite support 2022-12-06 23:10:29 +08:00
LICENSE chore: packages release under MIT license (#844) 2024-08-19 15:23:43 +08:00
lint-staged.config.js chore: rename (#356) 2024-01-30 22:20:05 +08:00
package.json chore: publish 1.4.1 release (#906) 2024-09-12 11:27:59 +08:00
README.md chore: rename (#356) 2024-01-30 22:20:05 +08:00
tsconfig.eslint.json fix: aggregation & chore: upgrade dependencies (#236) 2023-11-01 16:52:17 +08:00
tsconfig.json feat: release packages prepare (#477) 2024-03-20 19:03:52 +08:00

@teable/db-main-prisma

build

Intro

Basic demo of a shared package using prisma to handle database access, part of the nextjs-monorepo-example

Quick start

Start the database with docker-compose up database then run

cd packages/db-main-prisma
yarn prisma-db-push

See the .env(.local|.production|.development) file to edit the connection. Curious about the setup ?, we use dotenv-flow under the hood read this and see the script section of ./package.json

Install

Database

Option 0: sqlite local

The default env for PRISMA_DATABASE_URL is defined in the main .env file. By default, it connects to the sqlite file main.db

Option 1: Postgresql local (deprecated)

The default env for PRISMA_DATABASE_URL is defined in the main .env file. By default, it connects to the postgresql service defined in ../../docker-compose.yml.

Ensure you have docker and docker-compose and run

# In the root folder
docker-compose up database
# Alternatively, from any folder
yarn docker:up

Option 2: An hosted postgres instance (deprecated)

To quick start, you can use a free tier at supabase.io, but all providers will work.

As an example, simply create an .env.local and set the supabase pgbouncer url:

PRISMA_DATABASE_URL=postgresql://postgres:[PASSWORD]@[HOST]:[PORT]/postgres?schema=public&pgbouncer=true&sslmode=require&sslaccept=strict&sslcert=../config/certs/supabase-prod-ca-2021.crt

You can append &connection_limit=1 if deploying on a serverless/lambda provider (ie: vercel, netlify...)

DB creation

To create the database, simply run

yarn prisma-db-push

DB type generation

Create or update the types. This is generally automatically done in a postinstall from any app, see script section of ../../apps/nextjs-app/package.json or try it out with yarn workspace web-app postinstall

yarn prisma generate