Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Task/migrate to prisma configuration file (#5489)

David Requeno387c2bb6f3fa
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 962bcf07f7..6c84775e8c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improved the search in the _Yahoo Finance_ service
- Moved the holdings table into the holdings section on the public page
+- Migrated to the _Prisma Configuration File_ approach (`prisma.config.ts`)
- Refactored the login with access token dialog component to standalone
- Prefixed the `crypto`, `fs` and `path` imports with `node:`
diff --git a/Dockerfile b/Dockerfile
index c740413ea0..be1bb53ea0 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -17,7 +17,8 @@ COPY ./CHANGELOG.md CHANGELOG.md
COPY ./LICENSE LICENSE
COPY ./package.json package.json
COPY ./package-lock.json package-lock.json
-COPY ./prisma/schema.prisma prisma/schema.prisma
+COPY ./prisma.config.ts prisma.config.ts
+COPY ./prisma/schema.prisma prisma/
RUN npm install
@@ -25,8 +26,8 @@ RUN npm install
COPY ./decorate-angular-cli.js decorate-angular-cli.js
RUN node decorate-angular-cli.js
-COPY ./apps apps
-COPY ./libs libs
+COPY ./apps apps/
+COPY ./libs libs/
COPY ./jest.config.ts jest.config.ts
COPY ./jest.preset.js jest.preset.js
COPY ./nx.json nx.json
@@ -40,14 +41,15 @@ RUN npm run build:production
WORKDIR /ghostfolio/dist/apps/api
# package.json was generated by the build process, however the original
# package-lock.json needs to be used to ensure the same versions
-COPY ./package-lock.json /ghostfolio/dist/apps/api/package-lock.json
+COPY ./package-lock.json /ghostfolio/dist/apps/api/
RUN npm install
-COPY prisma /ghostfolio/dist/apps/api/prisma
+COPY prisma.config.ts /ghostfolio/dist/apps/api/
+COPY prisma /ghostfolio/dist/apps/api/prisma/
# Overwrite the generated package.json with the original one to ensure having
# all the scripts
-COPY package.json /ghostfolio/dist/apps/api
+COPY package.json /ghostfolio/dist/apps/api/
RUN npm run database:generate-typings
# Image to run, copy everything needed from builder
@@ -60,8 +62,8 @@ RUN apt-get update && apt-get install -y --no-install-suggests \
openssl \
&& rm -rf /var/lib/apt/lists/*
-COPY --chown=node:node --from=builder /ghostfolio/dist/apps /ghostfolio/apps
-COPY --chown=node:node ./docker/entrypoint.sh /ghostfolio/entrypoint.sh
+COPY --chown=node:node --from=builder /ghostfolio/dist/apps /ghostfolio/apps/
+COPY --chown=node:node ./docker/entrypoint.sh /ghostfolio/
WORKDIR /ghostfolio/apps/api
EXPOSE ${PORT:-3333}
USER node
diff --git a/package.json b/package.json
index 9a68c6cc63..99d9243326 100644
--- a/package.json
+++ b/package.json
@@ -209,8 +209,5 @@
},
"engines": {
"node": ">=22.18.0"
- },
- "prisma": {
- "seed": "node prisma/seed.mts"
}
}
diff --git a/prisma.config.ts b/prisma.config.ts
new file mode 100644
index 0000000000..24da6d886b
--- /dev/null
+++ b/prisma.config.ts
@@ -0,0 +1,11 @@
+import 'dotenv/config';
+import { join } from 'node:path';
+import { defineConfig } from 'prisma/config';
+
+export default defineConfig({
+ migrations: {
+ path: join('prisma', 'migrations'),
+ seed: `node ${join('prisma', 'seed.mts')}`
+ },
+ schema: join('prisma', 'schema.prisma')
+});