diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6065b061..b543f928 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,13 +44,6 @@ jobs: run: | mv .github/config.workflow.toml config/config.toml - - name: Generate Prisma Client - run: | - bunx prisma generate - - - name: Migrate database - run: bun migrate - - name: Run tests run: | bun test diff --git a/Dockerfile b/Dockerfile index 8c6d1b8c..10a59a08 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,9 +21,7 @@ COPY . /temp COPY --from=install /temp/node_modules /temp/node_modules # Build the project WORKDIR /temp -RUN bunx --bun prisma generate RUN bun run prod-build -COPY prisma /temp/dist WORKDIR /temp/dist # copy production dependencies and source code into final image diff --git a/build.ts b/build.ts index c7b9ec8d..8a470423 100644 --- a/build.ts +++ b/build.ts @@ -32,6 +32,9 @@ await Bun.build({ // I apologize for this await $`sed -i 's|import("node_modules/|import("./node_modules/|g' dist/*.js`; +// Copy Drizzle migrations to dist +await $`cp -r drizzle dist/drizzle`; + // Copy Sharp to dist await $`mkdir -p dist/node_modules/@img`; await $`cp -r node_modules/@img/sharp-libvips-linux-* dist/node_modules/@img`; diff --git a/drizzle.config.ts b/drizzle.config.ts index cee649d5..2deb46bb 100644 --- a/drizzle.config.ts +++ b/drizzle.config.ts @@ -1,4 +1,4 @@ -// import { config } from "config-manager"; +import { config } from "config-manager"; import type { Config } from "drizzle-kit"; export default { @@ -6,19 +6,12 @@ export default { out: "./drizzle", schema: "./drizzle/schema.ts", dbCredentials: { - host: "localhost", - port: 40003, - user: "lysand", - password: "lysand", - database: "lysand", - }, - /* dbCredentials: { host: config.database.host, port: Number(config.database.port), user: config.database.username, password: config.database.password, database: config.database.database, - }, */ + }, // Print all statements verbose: true, // Always ask for confirmation diff --git a/entrypoint.sh b/entrypoint.sh index bd54bd19..299ad8dd 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -4,7 +4,6 @@ # Commands: # - `start`: Starts the server # - `cli`: Starts the CLI, sends all arguments to it -# - `prisma`: Execute a Prisma command, sends # Exit immediately if a command exits with a non-zero status. set -euo pipefail @@ -14,8 +13,6 @@ cd /app/dist # Parse first argument case "$1" in "start") - # Migrate the database and run - /bin/bash /app/entrypoint.sh prisma migrate deploy NITRO_PORT=5173 bun run ./frontend/server/index.mjs & NODE_ENV=production bun run ./index.js --prod ;; "cli") @@ -23,15 +20,6 @@ case "$1" in shift 1 bun run ./cli.js "$@" ;; - "prisma") - # Proxy all Prisma commands - # Use output of dist/prisma.js to get the env variable - shift 1 - # Set DATABASE_URL env variable to the output of bun run ./dist/prisma.js - export DATABASE_URL=$(bun run ./prisma.js) - # Execute the Prisma binary - bun run ./node_modules/.bin/prisma "$@" - ;; *) # Run custom commands exec "$@" diff --git a/package.json b/package.json index c916ad32..9a98e966 100644 --- a/package.json +++ b/package.json @@ -36,12 +36,8 @@ "fe:build": "bun --bun nuxt build packages/frontend", "fe:analyze": "bun --bun nuxt analyze packages/frontend", "start": "NITRO_PORT=5173 bun run dist/frontend/server/index.mjs & NODE_ENV=production bun run dist/index.js --prod", - "migrate-dev": "bun prisma migrate dev", - "migrate": "bun prisma migrate deploy", "lint": "bunx --bun eslint --config .eslintrc.cjs --ext .ts .", "prod-build": "bun run build.ts", - "prisma": "DATABASE_URL=$(bun run prisma.ts) bunx prisma", - "generate": "bun prisma generate", "benchmark:timeline": "bun run benchmarks/timelines.ts", "cloc": "cloc . --exclude-dir node_modules,dist,.output,.nuxt,meta,logs --exclude-ext sql,log", "cli": "bun run cli.ts" diff --git a/prisma.ts b/prisma.ts deleted file mode 100644 index 00e75c40..00000000 --- a/prisma.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { config } from "config-manager"; - -// Proxies all `bunx prisma` commands with an environment variable - -process.stdout.write( - `postgresql://${config.database.username}:${config.database.password}@${config.database.host}:${config.database.port}/${config.database.database}\n`, -); - -process.exit(0);