loup
loup
Explore posts from servers
DTDrizzle Team
Created by loup on 2/19/2025 in #help
How auto push schema and seed data when starting NextJS using Drizzle (with Docker)
I have an NextJS 15 app using Drizzle. ANd I would like to auto push and seed the data when starting the app. But how to do it ? I dont find any info about this... Btw there is my package.json :
{
...
"scripts": {
"dev": "next dev --turbopack",
"build": "next build",
"start": "npm run db:push && npm run db:seed && next start",
"lint": "next lint",
"type-check": "tsc -b",
"format": "prettier --write .",
"lint:fix": "next lint --fix",
"db:generate": "drizzle-kit generate",
"db:migrate": "drizzle-kit migrate",
"db:drop": "drizzle-kit drop",
"db:push": "drizzle-kit push",
"db:pull": "drizzle-kit pull",
"db:studio": "drizzle-kit studio",
"db:seed": "node -r esbuild-register ./src/db/seed.ts"
},
"dependencies": {
"drizzle-orm": "^0.39.3",
...
},
"devDependencies": {
"drizzle-kit": "^0.30.4",
...
}
}
{
...
"scripts": {
"dev": "next dev --turbopack",
"build": "next build",
"start": "npm run db:push && npm run db:seed && next start",
"lint": "next lint",
"type-check": "tsc -b",
"format": "prettier --write .",
"lint:fix": "next lint --fix",
"db:generate": "drizzle-kit generate",
"db:migrate": "drizzle-kit migrate",
"db:drop": "drizzle-kit drop",
"db:push": "drizzle-kit push",
"db:pull": "drizzle-kit pull",
"db:studio": "drizzle-kit studio",
"db:seed": "node -r esbuild-register ./src/db/seed.ts"
},
"dependencies": {
"drizzle-orm": "^0.39.3",
...
},
"devDependencies": {
"drizzle-kit": "^0.30.4",
...
}
}
My db:push and db:seed are working in local dev Thx a lot !
2 replies
DTDrizzle Team
Created by loup on 2/18/2025 in #help
Use 'query' with custom schema
I was wondering how to use the query operator with a custom schema (pgSchema). Because when doing :
const quiz = await db.query.quizzes
.findFirst({
where: (quiz, { eq }) => eq(quiz.id, 1),
});
return quiz ?? null;
const quiz = await db.query.quizzes
.findFirst({
where: (quiz, { eq }) => eq(quiz.id, 1),
});
return quiz ?? null;
With this schema definition :
export const quizSchema = pgSchema("quiz");

export const quizzes = quizSchema.table("quizzes", {
id: integer().primaryKey().generatedByDefaultAsIdentity(),
slug: text("slug").notNull(),
title: text("title").notNull(),
iso_3166_1: varchar({ length: 2 }) // can be null, if provided, means the quiz is country-specific
}, (table) => [
unique("quizzes_slug_unique").on(table.slug),
index("quizzes_iso_3166_1_index").on(table.iso_3166_1)
]);
export const quizSchema = pgSchema("quiz");

export const quizzes = quizSchema.table("quizzes", {
id: integer().primaryKey().generatedByDefaultAsIdentity(),
slug: text("slug").notNull(),
title: text("title").notNull(),
iso_3166_1: varchar({ length: 2 }) // can be null, if provided, means the quiz is country-specific
}, (table) => [
unique("quizzes_slug_unique").on(table.slug),
index("quizzes_iso_3166_1_index").on(table.iso_3166_1)
]);
I have this error :
[ Server ] Error: relation "quizzes" does not exist
[ Server ] Error: relation "quizzes" does not exist
1 replies
DTDrizzle Team
Created by loup on 2/17/2025 in #help
try to push : schema "XXX" does not exist
When I try to add a custom schema, the push command dont works :
export const quizSchema = pgSchema("quiz");

export const answerTypeEnum = quizSchema.enum("answer_type", ["single_choice", "multiple_choice", "boolean", "text", "number"]);

export const quizzes = quizSchema.table("quizzes", {
id: integer().primaryKey().generatedByDefaultAsIdentity(),
title: text("title").notNull(),
iso_3166_1: varchar({ length: 2 }) // can be null, if provided, means the quiz is country-specific
}, (table) => [
index("quizzes_iso_3166_1_index").on(table.iso_3166_1)
]);
export const quizSchema = pgSchema("quiz");

export const answerTypeEnum = quizSchema.enum("answer_type", ["single_choice", "multiple_choice", "boolean", "text", "number"]);

export const quizzes = quizSchema.table("quizzes", {
id: integer().primaryKey().generatedByDefaultAsIdentity(),
title: text("title").notNull(),
iso_3166_1: varchar({ length: 2 }) // can be null, if provided, means the quiz is country-specific
}, (table) => [
index("quizzes_iso_3166_1_index").on(table.iso_3166_1)
]);
I have this error :
$ drizzle-kit push
No config path provided, using default 'drizzle.config.ts'
Reading config file '/project/drizzle.config.ts'
Using 'pg' driver for database querying
[✓] Pulling schema from database...
error: schema "quiz" does not exist
$ drizzle-kit push
No config path provided, using default 'drizzle.config.ts'
Reading config file '/project/drizzle.config.ts'
Using 'pg' driver for database querying
[✓] Pulling schema from database...
error: schema "quiz" does not exist
any idea ?
5 replies
NNovu
Created by loup on 11/15/2024 in #🚀│general
Free trial ends ask to pay somehing
Well Im quick lost Ive just received an email from Novu saying that :
Your free trial ends on November 21, 2024
Your free trial for Novu Business Events and 1 more product with Novu US, Inc. will end soon. You have an upcoming payment on November 21, 2024.


If you add a payment method, the added payment method will be charged $250.00 or more every month, depending on usage.
Your free trial ends on November 21, 2024
Your free trial for Novu Business Events and 1 more product with Novu US, Inc. will end soon. You have an upcoming payment on November 21, 2024.


If you add a payment method, the added payment method will be charged $250.00 or more every month, depending on usage.
But Ive never subscribed to any Novu plan...
2 replies
NNovu
Created by loup on 11/15/2024 in #💬│support
How delete all activity feed items from Production env ?
Because Im stupid Ive did all my test in Production mode so a lot of in-app and pushs notification was send. How can I delete all of them ? (currently notifications are not in my production build so users dont gonna see it)
4 replies
NNovu
Created by loup on 11/13/2024 in #💬│support
How use FCM push in NextJS app
Okay I dont understand how we implement FCM push notification using novu in NextJS app. Because Ive added FCM to my workflow but I never receive the notification in my NextJS . My FCM (with service workers) integration seems to be good because Ive test it and its workring. FCM seems to use tokeen to authenticate a user but how novu know this token ?
4 replies
NNovu
Created by loup on 11/13/2024 in #💬│support
Error trying to sync to cloud (code based workflow)
Ive made an ExpressJS api and ive setup an endpoint /novu. Ive publish my app on subdomain.mydomain.com but when I try to sync manually with subdomain.mydomain.com/novu my logs :
[Error]: Unknown BridgeError: crypto is not defined
at bt.handleError (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:6281)
at bt.handleAction (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:4889)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:3618 {
data: {
stack: 'ReferenceError: crypto is not defined\n' +
' at Or (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:1:11777)\n' +
' at bt.validateHmac (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:6587)\n' +
' at bt.handleAction (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:4619)\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
' at async /app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:3618'
},
statusCode: 500,
code: 'BridgeError'
}
[Error]: Unknown BridgeError: crypto is not defined
at bt.handleError (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:6281)
at bt.handleAction (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:4889)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:3618 {
data: {
stack: 'ReferenceError: crypto is not defined\n' +
' at Or (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:1:11777)\n' +
' at bt.validateHmac (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:6587)\n' +
' at bt.handleAction (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:4619)\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
' at async /app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:3618'
},
statusCode: 500,
code: 'BridgeError'
}
16 replies
NNovu
Created by loup on 11/10/2024 in #💬│support
TypeError: undefined is not an object (evaluating 'navigator.locks.request')
Im just using the default Inbox component from @novu/react. Its working on desktop but on mobile I have the error. I have no idea how to debug it
7 replies
NNovu
Created by loup on 11/8/2024 in #💬│support
Best way to sync subscribers settings with Postgres database
I have my backedn using postgres db. I have a table user :
id
username
avatar_url
language
id
username
avatar_url
language
How can I sync this table with the subscriber setting in Novu ? I could use Postgres trigger when there is a change in postgres db and make the request too Novu ?
9 replies
NNovu
Created by loup on 11/7/2024 in #💬│support
Is Novu right for me?
Hi ! Im a student building a web app (also PWA) using Supabase as backend. I wanna add notification : in-app, push notification (like the one with Google Chrome), email, etc... Can I do all of this with Novu ? I also need to translate every notification depending of the language of my user (in my db user can set their preferred language). Can I do that with free tier of Novu ? Or self hosted ? Thx per advance !
7 replies