Thanks for the video, it was really useful for helping set up drizzle with the postgres-js driver! The only things that I did differently were: 1. Importing from 'drizzle-orm/postgres-js' for the type of the db variable in the constructor of the service that I am injecting it. 2. Importing from 'drizzle-orm/pg-core' and using these definitions for the schema.ts file. 3. Exporting form the schema.ts file the types like so: export type UserAdded = typeof user.$inferInsert; 4. Inside the drizzle.config.ts file I have used dotenv to import my env variables like so: import { config } from 'dotenv'; config({ path: `.env.${process.env.NODE_ENV}` }); and created an npm script like so: "migrations:push": "cross-env NODE_ENV=development npx drizzle-kit push:pg" similarly created one to generate migrations and one to drop them. Hope this helps anyone looking to set this up with postgres-js !
I used ChatGPT to generate this timestamps so it might not be accurate: 0:00 - Introduction and overview of the video. 1:05 - Removing the Prisma client and dependencies. 1:52 - Installing Drizzle ORM and SQLite3 driver. 2:22 - Creating the schema.ts file for Drizzle ORM. 3:12 - Defining the "users" table in the schema.ts file. 5:32 - Deleting the Prisma directory. 5:52 - Creating the Drizzle provider for the Nest.js application. 9:11 - Refactoring the "create" function in the user service. 13:00 - Refactoring the "findByEmail" function in the user service. 15:36 - Refactoring the "findById" function in the user service. 16:54 - Registering the Drizzle provider in the user module. 18:38 - Running migrations to create the SQLite database. 20:56 - Testing the application with Insomnia. 22:27 - Recapping the key steps and achievements in the video.
You’re recreating a database connection for every module. You shouldn’t be adding drizzeProviders to your users and auto modules. You should be importing the Drizzle module instead.
hello, I got stucked to implement google adsense to my newly released nextjs 13.4(App Router) project. I tried most of the tutorials which I found on google search and youtube search and didnot found any solutions to implement google adsense. I tried many npm packages also but they didnot worked for me also. Please make a video on how we can implement google adsense on Nextjs 13.4(app router) without losing SSR.
Hello! Could you help me, please? At 9:31 I get an error. @Module({ providers: [...drizzleProvider], }) the provider is highlighted as an error. I have provided the error text below. what is it and how can I fix it? Type '{ provider: string; useFactory: () => Promise; exports: string[]; }[]' is not assignable to type 'Provider[]'. Type '{ provider: string; useFactory: () => Promise; exports: string[]; }' is not assignable to type 'Provider'. Property 'provide' is missing in type '{ provider: string; useFactory: () => Promise; exports: string[]; }' but required in type 'FactoryProvider'.ts(2322)
Thanks for the video, it was really useful for helping set up drizzle with the postgres-js driver!
The only things that I did differently were:
1. Importing from 'drizzle-orm/postgres-js' for the type of the db variable in the constructor of the service that I am injecting it.
2. Importing from 'drizzle-orm/pg-core' and using these definitions for the schema.ts file.
3. Exporting form the schema.ts file the types like so: export type UserAdded = typeof user.$inferInsert;
4. Inside the drizzle.config.ts file I have used dotenv to import my env variables like so:
import { config } from 'dotenv';
config({ path: `.env.${process.env.NODE_ENV}` });
and created an npm script like so:
"migrations:push": "cross-env NODE_ENV=development npx drizzle-kit push:pg"
similarly created one to generate migrations and one to drop them.
Hope this helps anyone looking to set this up with postgres-js !
Do you have the repo for the postgres database setup ?
could you share it to me please ? appreciate it
I used ChatGPT to generate this timestamps so it might not be accurate:
0:00 - Introduction and overview of the video.
1:05 - Removing the Prisma client and dependencies.
1:52 - Installing Drizzle ORM and SQLite3 driver.
2:22 - Creating the schema.ts file for Drizzle ORM.
3:12 - Defining the "users" table in the schema.ts file.
5:32 - Deleting the Prisma directory.
5:52 - Creating the Drizzle provider for the Nest.js application.
9:11 - Refactoring the "create" function in the user service.
13:00 - Refactoring the "findByEmail" function in the user service.
15:36 - Refactoring the "findById" function in the user service.
16:54 - Registering the Drizzle provider in the user module.
18:38 - Running migrations to create the SQLite database.
20:56 - Testing the application with Insomnia.
22:27 - Recapping the key steps and achievements in the video.
Hi, Thanks 🙏. Is it chatGPT 4 ?
Thank you sir. This is the only video for which i was waiting
👋, Yes it's finally there. Thanks for your patience 🙏👍
Was waiting for tests with drizzle. How you mock it for jest?
You’re recreating a database connection for every module. You shouldn’t be adding drizzeProviders to your users and auto modules. You should be importing the Drizzle module instead.
could you elaborate on this?
i was looking for this comment, people shouldn’t be doing this
What about postgres?
I am creating a comprehensive course that involves postgres.
The vscode theme is too beautiful, which one is it?
Hi, it's bearded theme
Please create video about saml 😢
Hi 👋, I need to do some research about it.
Nice video...please also implement repository pattern in Nestjs with drizzle and swagger
What should you put in the dizzle provider file if you want to use postgre instead of sqlite?
hello, I got stucked to implement google adsense to my newly released nextjs 13.4(App Router) project. I tried most of the tutorials which I found on google search and youtube search and didnot found any solutions to implement google adsense. I tried many npm packages also but they didnot worked for me also. Please make a video on how we can implement google adsense on Nextjs 13.4(app router) without losing SSR.
Hello! Could you help me, please?
At 9:31 I get an error.
@Module({
providers: [...drizzleProvider],
})
the provider is highlighted as an error. I have provided the error text below. what is it and how can I fix it?
Type '{ provider: string; useFactory: () => Promise; exports: string[]; }[]' is not assignable to type 'Provider[]'.
Type '{ provider: string; useFactory: () => Promise; exports: string[]; }' is not assignable to type 'Provider'.
Property 'provide' is missing in type '{ provider: string; useFactory: () => Promise; exports: string[]; }' but required in type 'FactoryProvider'.ts(2322)
This is waaay too complicated. I would've just stick with prisma if I had to start a new project...
Prisma is really straightforward but in performance, Drizzle ORM comes first 🥇
Prisma is really straightforward but in performance, Drizzle ORM comes first 🥇