From a4500e53ce764ee5b7267537ac34de0203dc9553 Mon Sep 17 00:00:00 2001 From: Laurenz Honauer Date: Fri, 16 Jun 2023 12:14:00 +0200 Subject: [PATCH] fix(workspace): enable connection between docker image and planetscale --- SETUP.md | 3 ++- apps/api/Dockerfile | 4 ++-- packages/database/prisma/schema.prisma | 13 ++++++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/SETUP.md b/SETUP.md index 23c49de1..c30e7a05 100644 --- a/SETUP.md +++ b/SETUP.md @@ -31,7 +31,8 @@ Setup has only been tested on Apple Silicon M1 Macs. Linux could work but is not 4. [React Native Local Setup](https://reactnative.dev/docs/environment-setup?guide=native) is completed 5. Install `turborepo` globally with `npm i turbo -g` 6. Install yarn globally with `volta install yarn@1.22` -7. Run `yarn prep` to install node module and setup database +7. For Local Development replace "mysql" with "sqlite" in the `schema.prisma` file +8. Run `yarn prep` to install node module and setup database On error `xcrun: error: SDK "iphoneos" cannot be located` it may be necessray to run `npx pod-install` in the `mobile` app folder diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index 2b0caa7a..04f67d93 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -1,5 +1,5 @@ # Install Turbo and Prune -FROM amd64/node:16-bullseye-slim AS builder +FROM amd64/node:16 AS builder WORKDIR /app RUN yarn global add turbo @@ -30,7 +30,7 @@ COPY turbo.json turbo.json RUN yarn turbo run build --filter=@superlight-labs/api... # Setup Process and run command -FROM amd64/node:16-bullseye-slim AS runner +FROM amd64/node:16 AS runner WORKDIR /app RUN addgroup --system --gid 1001 superlight-api diff --git a/packages/database/prisma/schema.prisma b/packages/database/prisma/schema.prisma index b648fc83..96f86bd0 100644 --- a/packages/database/prisma/schema.prisma +++ b/packages/database/prisma/schema.prisma @@ -1,12 +1,13 @@ datasource db { - provider = "sqlite" + provider = "mysql" // "sqlite" for development url = env("DB_URL") - // relationMode = "prisma" + relationMode = "prisma" } generator client { - provider = "prisma-client-js" + provider = "prisma-client-js" + engineType = "binary" } model User { @@ -31,6 +32,8 @@ model ExternalAddress { updatedAt DateTime @updatedAt sentTransactions Transaction[] @relation("sentTransactions") recievedTransactions Transaction[] @relation("recievedTransactions") + + @@index([userEmail]) } model Transaction { @@ -42,6 +45,9 @@ model Transaction { sender ExternalAddress @relation(name: "sentTransactions", fields: [senderAddress], references: [address]) senderAddress String note String? + + @@index([recieverAddress]) + @@index([senderAddress]) } model MpcKeyShare { @@ -57,4 +63,5 @@ model MpcKeyShare { updatedAt DateTime @updatedAt @@unique([userId, path]) + @@index([userId, userDevicePublicKey]) }