Compare commits

..

1 Commits

Author SHA1 Message Date
Flea Flicker d6aa256b5a fix(seed): use --filter @groombook/db to invoke seed/migrate/reset scripts
CI / Lint & Typecheck (pull_request) Failing after 15s
CI / Test (pull_request) Failing after 20s
CI / Build & Push Docker Image (pull_request) Has been skipped
The seed/migrate/reset Dockerfile targets specified `pnpm db:migrate`
etc., but those scripts are defined in packages/db/package.json, not
at the workspace root. pnpm workspace filtering is required to route
the command to the correct package.

- migrate: pnpm --filter @groombook/db migrate
- seed:    pnpm --filter @groombook/db seed
- reset:   pnpm --filter @groombook/db reset

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-22 12:33:17 +00:00
6 changed files with 17 additions and 67 deletions
+4 -44
View File
@@ -25,7 +25,7 @@ jobs:
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: 22 node-version: 20
cache: pnpm cache: pnpm
- name: Install dependencies - name: Install dependencies
@@ -49,7 +49,7 @@ jobs:
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: 22 node-version: 20
cache: pnpm cache: pnpm
- name: Install dependencies - name: Install dependencies
@@ -59,7 +59,7 @@ jobs:
run: pnpm test run: pnpm test
docker: docker:
name: Build & Push Docker Images name: Build & Push Docker Image
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [lint-typecheck, test] needs: [lint-typecheck, test]
steps: steps:
@@ -91,49 +91,9 @@ jobs:
with: with:
context: . context: .
file: Dockerfile file: Dockerfile
target: runner
push: true push: true
tags: | tags: |
git.farh.net/groombook/api:${{ steps.version.outputs.tag }} git.farh.net/groombook/api:${{ steps.version.outputs.tag }}
${{ github.ref == 'refs/heads/main' && 'git.farh.net/groombook/api:latest' || '' }} ${{ github.ref == 'refs/heads/main' && 'git.farh.net/groombook/api:latest' || '' }}
cache-from: type=registry,ref=git.farh.net/groombook/cache:api cache-from: type=registry,ref=git.farh.net/groombook/cache:api
cache-to: type=registry,ref=git.farh.net/groombook/cache:api,mode=max cache-to: type=registry,ref=git.farh.net/groombook/cache:api,mode=max
- name: Build and push Migrate image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
target: migrate
push: true
tags: |
git.farh.net/groombook/migrate:${{ steps.version.outputs.tag }}
${{ github.ref == 'refs/heads/main' && 'git.farh.net/groombook/migrate:latest' || '' }}
cache-from: type=registry,ref=git.farh.net/groombook/cache:migrate
cache-to: type=registry,ref=git.farh.net/groombook/cache:migrate,mode=max
- name: Build and push Seed image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
target: seed
push: true
tags: |
git.farh.net/groombook/seed:${{ steps.version.outputs.tag }}
${{ github.ref == 'refs/heads/main' && 'git.farh.net/groombook/seed:latest' || '' }}
cache-from: type=registry,ref=git.farh.net/groombook/cache:seed
cache-to: type=registry,ref=git.farh.net/groombook/cache:seed,mode=max
- name: Build and push Reset image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
target: reset
push: true
tags: |
git.farh.net/groombook/reset:${{ steps.version.outputs.tag }}
${{ github.ref == 'refs/heads/main' && 'git.farh.net/groombook/reset:latest' || '' }}
cache-from: type=registry,ref=git.farh.net/groombook/cache:reset
cache-to: type=registry,ref=git.farh.net/groombook/cache:reset,mode=max
+3 -3
View File
@@ -25,7 +25,7 @@ jobs:
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: 22 node-version: 20
cache: pnpm cache: pnpm
- name: Install dependencies - name: Install dependencies
@@ -49,7 +49,7 @@ jobs:
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: 22 node-version: 20
cache: pnpm cache: pnpm
- name: Install dependencies - name: Install dependencies
@@ -71,7 +71,7 @@ jobs:
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: 22 node-version: 20
cache: pnpm cache: pnpm
- name: Install dependencies - name: Install dependencies
+5 -5
View File
@@ -1,4 +1,4 @@
FROM node:22-alpine AS base FROM node:20-alpine AS base
RUN corepack enable && corepack prepare pnpm@9.15.4 --activate RUN corepack enable && corepack prepare pnpm@9.15.4 --activate
WORKDIR /app WORKDIR /app
@@ -20,7 +20,7 @@ RUN pnpm --filter @groombook/types build && \
pnpm --filter @groombook/api build pnpm --filter @groombook/api build
# Runtime # Runtime
FROM node:22-alpine AS runner FROM node:20-alpine AS runner
RUN corepack enable && corepack prepare pnpm@9.15.4 --activate RUN corepack enable && corepack prepare pnpm@9.15.4 --activate
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production ENV NODE_ENV=production
@@ -42,12 +42,12 @@ CMD ["node", "dist/index.js"]
# Migrate stage — runs drizzle-kit migrate against the database # Migrate stage — runs drizzle-kit migrate against the database
FROM builder AS migrate FROM builder AS migrate
CMD ["pnpm", "db:migrate"] CMD ["pnpm", "--filter", "@groombook/db", "migrate"]
# Seed stage — populates the database with test data # Seed stage — populates the database with test data
FROM builder AS seed FROM builder AS seed
CMD ["pnpm", "db:seed"] CMD ["pnpm", "--filter", "@groombook/db", "seed"]
# Reset stage — drops all tables, re-runs migrations, and re-seeds # Reset stage — drops all tables, re-runs migrations, and re-seeds
FROM builder AS reset FROM builder AS reset
CMD ["pnpm", "db:reset"] CMD ["pnpm", "--filter", "@groombook/db", "reset"]
@@ -135,7 +135,7 @@ function makeDeleteChainable(): unknown {
} }
if (prop === "returning") { if (prop === "returning") {
return () => { return () => {
const row = petRows[0]!; const row = petRows[0];
deletedId = row.id as string; deletedId = row.id as string;
return [row]; return [row];
}; };
@@ -165,10 +165,10 @@ vi.mock("../db", async (importOriginal) => {
}), }),
pets, pets,
appointments, appointments,
and: vi.fn(), and: db.and,
eq: vi.fn(), eq: db.eq,
exists: vi.fn(), exists: db.exists,
or: vi.fn(), or: db.or,
}; };
}); });
-9
View File
@@ -67,11 +67,6 @@ vi.mock("../db", () => {
{ get: (t, p) => (p === "_name" ? "impersonationSessions" : { table: "impersonationSessions", column: p }) } { get: (t, p) => (p === "_name" ? "impersonationSessions" : { table: "impersonationSessions", column: p }) }
); );
const impersonationAuditLogs = new Proxy(
{ _name: "impersonationAuditLogs" },
{ get: (t, p) => (p === "_name" ? "impersonationAuditLogs" : { table: "impersonationAuditLogs", column: p }) }
);
const appointments = new Proxy( const appointments = new Proxy(
{ _name: "appointments" }, { _name: "appointments" },
{ get: (t, p) => (p === "_name" ? "appointments" : { table: "appointments", column: p }) } { get: (t, p) => (p === "_name" ? "appointments" : { table: "appointments", column: p }) }
@@ -104,12 +99,8 @@ vi.mock("../db", () => {
}), }),
}), }),
}), }),
insert: () => ({
values: () => ({ returning: () => [{}] }),
}),
}), }),
impersonationSessions, impersonationSessions,
impersonationAuditLogs,
appointments, appointments,
eq: vi.fn(), eq: vi.fn(),
and: vi.fn(), and: vi.fn(),
-1
View File
@@ -3,7 +3,6 @@
"version": "0.0.1", "version": "0.0.1",
"private": true, "private": true,
"type": "module", "type": "module",
"packageManager": "pnpm@9.15.4",
"scripts": { "scripts": {
"dev": "tsx watch src/index.ts", "dev": "tsx watch src/index.ts",
"build": "tsc --project .", "build": "tsc --project .",