x03
x03
Explore posts from servers
DTDrizzle Team
Created by x03 on 7/25/2024 in #help
Issues deploying with Dockerfile
I'm using SvelteKit, and I run my migrations on app start in hooks.server.ts After building with Dockerfile, I get these runtime errors nonstop:
Node.js v18.20.4
file:///app/node_modules/drizzle-orm/migrator.js:19
throw new Error(`Can't find meta/_journal.json file`);
^

Error: Can't find meta/_journal.json file
at readMigrationFiles (file:///app/node_modules/drizzle-orm/migrator.js:19:11)
at migrate (file:///app/node_modules/drizzle-orm/postgres-js/migrator.js:3:22)
at file:///app/build/server/chunks/hooks.server-ypJT85G1.js:31:1
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v18.20.4
file:///app/node_modules/drizzle-orm/migrator.js:19
throw new Error(`Can't find meta/_journal.json file`);
^

Error: Can't find meta/_journal.json file
at readMigrationFiles (file:///app/node_modules/drizzle-orm/migrator.js:19:11)
at migrate (file:///app/node_modules/drizzle-orm/postgres-js/migrator.js:3:22)
at file:///app/build/server/chunks/hooks.server-ypJT85G1.js:31:1
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Here's my Dockerfile:
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json .
RUN yarn install
COPY . .
RUN yarn run build

FROM node:18-alpine
WORKDIR /app
COPY --from=builder /app/build build/
COPY --from=builder /app/node_modules node_modules/
COPY package.json .
EXPOSE 3000
ENV NODE_ENV=production
CMD ["node", "build"]
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json .
RUN yarn install
COPY . .
RUN yarn run build

FROM node:18-alpine
WORKDIR /app
COPY --from=builder /app/build build/
COPY --from=builder /app/node_modules node_modules/
COPY package.json .
EXPOSE 3000
ENV NODE_ENV=production
CMD ["node", "build"]
3 replies
DTDrizzle Team
Created by x03 on 4/13/2024 in #help
Need help with a migration
No description
2 replies
DTDrizzle Team
Created by x03 on 3/19/2024 in #help
How do I apply migrations on cloudflare workers?
No description
23 replies
DTDrizzle Team
Created by x03 on 3/13/2024 in #help
Need syntax help
I've been trying out drizzle for a couple hours, and was wondering if there's any way to replicate this action from prisma:
const session = await prisma.session.create({
data: {
userAgent: event.request.headers.get("user-agent"),
user: {
connectOrCreate: {
where: {
email: form.data.email,
},
create: {
email: form.data.email,
},
},
},
},
select: {
id: true,
},
})
const session = await prisma.session.create({
data: {
userAgent: event.request.headers.get("user-agent"),
user: {
connectOrCreate: {
where: {
email: form.data.email,
},
create: {
email: form.data.email,
},
},
},
},
select: {
id: true,
},
})
Is there an equivalent to this way of creating a session that's just as efficient? The main appeal is the "connectOrCreate" functionality.
7 replies