TypeORM v0.3.x Migrations, queries, with NestJS!

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ย. 2024

ความคิดเห็น • 200

  • @eugenematsetska8406
    @eugenematsetska8406 4 หลายเดือนก่อน

    best tutorial about migration for nestjs
    ** in my case was issue that i did use yarn+morepo - better use npm for run migrations

  • @Yoshgunn
    @Yoshgunn ปีที่แล้ว +1

    Definitely would love a Query Builder crash course one day!!

  • @AliAliOxenFree
    @AliAliOxenFree ปีที่แล้ว

    this is a very valuable video. all the other migration guides out there are for the outdated typeorm. even chatgpt is stuck on the ormconfig.json method which has been deprecated.
    thanks for the lesson!

  • @lukramingo1496
    @lukramingo1496 ปีที่แล้ว +7

    I have been stuck for two days typeorm migration generate, now you save my life...........Please create more videos about nestjs for new versions upto date👍

    • @RezHimself
      @RezHimself หลายเดือนก่อน

      same happened to me, thanks

  • @veritatas678
    @veritatas678 ปีที่แล้ว +1

    Cool explanation of typorm.
    could you maybe do a video on platformatic ?
    It recently came out and is basically an ORM that also creates CRUD endpoints + graphql.

  • @vincenttosinmicheal4640
    @vincenttosinmicheal4640 10 หลายเดือนก่อน

    Thanks a lot.

  • @NicolaMazzocato
    @NicolaMazzocato ปีที่แล้ว

    Thank you for your help! :)

  • @alexandrecastro9528
    @alexandrecastro9528 ปีที่แล้ว

    You saved a Brazilian intern!

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว +1

      Haha great! Hope your internship goes well!

    • @alexandrecastro9528
      @alexandrecastro9528 ปีที่แล้ว

      @@mariusespejo Man, the migrations part isn't clear on docs. The NestJS docs basically says: Go to see the typeorm docs. And the typeorm docs don't consider the Nest Pattern ( typeorm module). So, it was impossible to instantiate a datasource that both recognized and it was possible to specify to cli the typeorm where it was. I'm really grateful 👏💪🏻

  • @eric55099
    @eric55099 หลายเดือนก่อน

    U d best

  • @kakelayes1298
    @kakelayes1298 9 หลายเดือนก่อน

    good video

  • @mehdimahmud5191
    @mehdimahmud5191 ปีที่แล้ว

    Thank you for your great videos. on nestjs. Any tool available if I want to import all the stored procedures and entities from sql server database?

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว +1

      There are 3rd party tools like this one:
      www.npmjs.com/package/typeorm-model-generator
      Although other tools have much better first-class support for introspection, e.g. prisma, drizzle-orm, etc

    • @mehdimahmud5191
      @mehdimahmud5191 ปีที่แล้ว

      @@mariusespejo thank you for the reply. I apretiate it.

  • @radosawhasiuk3478
    @radosawhasiuk3478 2 ปีที่แล้ว +1

    Hi, just a question. Why don't you use typeorm-ts-node-commonjs to run migrations on .ts files but instead you build the app and run it on .js files? Is there any reason for that or just preference?

    • @mariusespejo
      @mariusespejo  2 ปีที่แล้ว +1

      I did talk about that in the video actually, basically the nest app works off of dist when you’re running it, so if you reference ts files there it will error. The approach you’re suggesting is possible if you don’t share the same data source options between the app and the typeorm cli

    • @radosawhasiuk3478
      @radosawhasiuk3478 2 ปีที่แล้ว

      Thanks its clear to me now

  • @mdtowhidulislam5260
    @mdtowhidulislam5260 ปีที่แล้ว

    hey Marius Espejo, Can you please share the way for postgres? It would be really helpful for me.

  • @eclipse-cmd
    @eclipse-cmd ปีที่แล้ว

    It would be really kind of you if you can give us a link to the code repository.

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      Sorry no repo, this was really meant more as a quick lesson rather than a project to clone. If you need a written resource I recommend the docs

    • @eclipse-cmd
      @eclipse-cmd ปีที่แล้ว

      @@mariusespejo thank you🙂

  • @abrutii
    @abrutii ปีที่แล้ว

    Seems like we can't pass in the config service to the DataSourceOptions object, that's really a pain in a situation where u have many Nest applications...
    e.g. I'm on a project that has libraries and many apps (not following the multirepository architecture of NestJs doc). I have a library that encapsulates TypeOrm logic and the config depends on the APP. I used to pass in configservice, but with data sources this changes everything

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      you can still do TypeOrmModule.forRootAsync(), which allows you to pass in a useClass (provider) or useFactory (function) both of which allow injection. That API is fairly standard to a lot of 3rd party modules, for cases when you need to initialize something async

    • @abrutii
      @abrutii ปีที่แล้ว

      @@mariusespejo but you can’t pass it to the data source object in the data source file right ?

  • @reymarkandog1441
    @reymarkandog1441 2 ปีที่แล้ว

    Which file icon and theme you are using?

    • @mariusespejo
      @mariusespejo  2 ปีที่แล้ว +1

      During actual work I usually use Monokai Pro, the icons come from that. However for tutorials I tend to use darker themes, in this one github dark

  • @dendytbm3113
    @dendytbm3113 ปีที่แล้ว

    how to do refresh migration? start all over again at once, not revert one by one

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      You can delete the records in the migration table and drop all your tables, or add a drop if exists on your migrations

  • @Cognitoman
    @Cognitoman ปีที่แล้ว

    Dude you need start a discord.

  • @lord4791
    @lord4791 ปีที่แล้ว

    Can you make some nextjs 13 video please? :)

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      I actually am planning to!

  • @kietne9251
    @kietne9251 ปีที่แล้ว +1

    I dont understand why my migration ignores my entity. It does not generate newMigration. Only table "migraions" is generated in my database

    • @AliAliOxenFree
      @AliAliOxenFree ปีที่แล้ว

      could be an issue with the glob pattern?

  • @mikoajrenke2985
    @mikoajrenke2985 ปีที่แล้ว +4

    Thanks for sharing this!
    The documentation regarding this Topic is currently so insufficient that I was really struggling...
    With this Tutorial, it all went smoothly!

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      Yeah the typeorm docs are really bad at the moment.. glad the video helps!

  • @soroushmadani
    @soroushmadani ปีที่แล้ว +1

    That was amazing!
    I have a question though, I am using configService in datasourceOptions. I couldn't do the same for configService (new ConfigService(configOptions)).
    What am I supposed to do?

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      ConfigService (or pretty much most things in Nest) is not meant to be instantiated with “new” like that. It’s meant to be injected by nest. I suggest taking a look at the config module docs

  • @ICOReviewtoken
    @ICOReviewtoken ปีที่แล้ว

    Hi bro. I want to setup multi tenancy 1 database and multiple schemas. each schema is generated from a subdomain and is unique. What I have to do ?

  • @RafaelPascual
    @RafaelPascual ปีที่แล้ว +3

    Hi Marius, I'm wondering why I can't find you in udemy. Your tutorial is more robust, easier to understand and more useful in real-life situations than any tutorials I found there. Thank you so much for giving us free tutorials.

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      Yes all my stuff is free at the moment on youtube. Thank you for your comment!

  • @tkchannel5856
    @tkchannel5856 2 ปีที่แล้ว +2

    Thank you for this vid, after your previous one on TypeORM i had problems with migrations on CLI v0.3, finally there is a somewhat complete guide on new version

  • @FlavienBesseau
    @FlavienBesseau 2 หลายเดือนก่อน

    Thanks man. Even chatgpt was bad to help me with postgres and typeorm

  • @weekndninja
    @weekndninja ปีที่แล้ว

    After execution of script no data is getting inserted to the migration table. Also how is the data getting inserted without any insert uery

  • @jonathanndambuki6216
    @jonathanndambuki6216 ปีที่แล้ว +1

    Hello Take us on Query Builder Please.

  • @rahman9418
    @rahman9418 ปีที่แล้ว +3

    hi marius do you have udemy online classes for nest js ? are you interested in making it? because it's a good thing for developers, I want to learn it from beginner to intermediate or advance

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว +1

      I don’t at the moment, you’ll find lots of free nest content in my channel though

    • @rahman9418
      @rahman9418 ปีที่แล้ว

      @@mariusespejo okay, but if you make it me and other developers might be interested in using nestjs for a real project, and it will be very good for its development, I'm looking forward to it on udemy, nestjs with a real project tutorial example, thank you

  • @shakapaker
    @shakapaker ปีที่แล้ว +11

    Please don't stop making videos, your way of explaining it's amazing 😻

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว +1

      Thanks 🙂 I’ve been a little busy lately but plan to get back into it soon!

  • @EstebanHelgueroCardiff
    @EstebanHelgueroCardiff 5 หลายเดือนก่อน

    Hi Marius! Question, how do you manage migrations in production? Do you run a GitHub action to apply the migrations to DB or do you have any other way to do It? Thanks

    • @mariusespejo
      @mariusespejo  4 หลายเดือนก่อน +1

      I’d suggest having a test or staging DB to test things out first. But then to apply it for production, pretty much yeah you can trigger in whatever pipeline tech you are using, assuming it has access to update your Database. How that is done honestly depends per company though

  • @mutaqinyusuf2190
    @mutaqinyusuf2190 ปีที่แล้ว +1

    You are just amazing, straightforward and I barely can understand the points easily!!! Thanksss

  • @carlosemmanuelarcosnovelo7711
    @carlosemmanuelarcosnovelo7711 10 หลายเดือนก่อน

    Thanks so much... I just have a question, if we have other databa different than sqlite and go to producction, how can set my password and user in the datasourceOptions. I tried to set my env variables but I got a error, it seems that the env is undefined

    • @mariusespejo
      @mariusespejo  10 หลายเดือนก่อน

      I suggest using the ConfigModule with nestjs, they have docs on it. It’s basically like dotenv

  • @biserivanov3433
    @biserivanov3433 ปีที่แล้ว +1

    I have watched many similar tutorials how to do migrations and your is by far the best one. Thanks for the great content.

  • @randompointlessness2766
    @randompointlessness2766 หลายเดือนก่อน

    What about inmemory sqlite ?

  • @onrightside
    @onrightside ปีที่แล้ว

    Migration:generate cmd generated a migration file which contains all the entities. it's a mess. Is there any way to generate separate migration file for each entity ?

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว +1

      That means you’re generating off of an empty database so that’s kind of expected. If you want it one at a time then make a new entity, generate, migrate…rinse repeat. You also can just split up that giant file yourself

  • @eleshovictor1963
    @eleshovictor1963 หลายเดือนก่อน

    Please do a detailed video of the Query Builder

  • @pierreaillet9249
    @pierreaillet9249 4 หลายเดือนก่อน

    Thank you so much man, very helpful

  • @ron-almog
    @ron-almog ปีที่แล้ว +1

    Yes, it works, finally! thank you for clarifying the tricks of the new version!

  • @syedumairnaeem6724
    @syedumairnaeem6724 2 ปีที่แล้ว +3

    The way you explain complex stuff is just amazing. Learned a lot about nest and testing from your videos. I was looking for a tutorial on migration and here it is. Much appreciated.

    • @mariusespejo
      @mariusespejo  2 ปีที่แล้ว +1

      Thanks for the feedback 🙏

    • @mohammadumar443
      @mohammadumar443 ปีที่แล้ว

      @@mariusespejo how can we do DB first using typeorm and nestjs ? I just want to connect to DB and write APIs with the data in the DB.

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      Not sure what you mean by DB first. With typeorm you would typically create entities representing your database tables, then you can connect and write APIs. I have several videos on nest and typeorm if you check the channel

  • @TylerJusCodes
    @TylerJusCodes ปีที่แล้ว

    HI, i'm having issues .. when i want to create a migration , it can't find my entites. until i had to import them into the entites array.
    now i want to run migrations, and it can't find the migrations folder in the dist. but it's there

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว +1

      Assuming you followed the video exactly, then I’m not sure. Might want to ask in stackoverflow

  • @sumitmahajan5730
    @sumitmahajan5730 ปีที่แล้ว

    Hey we are not able to create migration using nest 9.2.0 and node 16.13.0 can you tell us what is there reason

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      Not sure, did you follow the video? Otherwise please check the release notes of your dependencies

  • @Torres158
    @Torres158 ปีที่แล้ว +1

    Great video! It helped me understand TypeOrm better.

  • @inanesilence
    @inanesilence ปีที่แล้ว

    Migrations register automatically schema of the database or is it necessary to specify it in the query runner?

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      Not sure I understand your question

  • @Raihan004
    @Raihan004 ปีที่แล้ว

    make one a Query Builder crash course please

  • @tonyeneh8194
    @tonyeneh8194 ปีที่แล้ว +1

    you're soo good with explaining stuff. You have a way of figuring out questions that would crop up in viewers minds and then answering them just as they come up. Keep it up bro 👏👏👏

  • @mouadelhilali2082
    @mouadelhilali2082 2 ปีที่แล้ว +1

    Finally !!! LOVE YOU

  • @davidferreira3926
    @davidferreira3926 ปีที่แล้ว

    finally i undertand. Thanks bro

  • @mustafakendiguzel468
    @mustafakendiguzel468 ปีที่แล้ว

    I am getting No changes in database schema were found - cannot generate a migration. To create a new empty migration use "typeorm migration:create" command error when try generate,do you know why is that happen?

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      Guessing your cli isn’t finding the entities, so there is no schema to actually compare with the database, which leads to not being able to generate anything

    • @denizsultanoglu6538
      @denizsultanoglu6538 ปีที่แล้ว

      Kanka çözebildin mi sorunu?

  • @biximi2625
    @biximi2625 10 หลายเดือนก่อน

    how do i activate the sqlite viewer in vscode, kindly reqesting for your help

    • @mariusespejo
      @mariusespejo  10 หลายเดือนก่อน

      It is just an extension, you can search for it in the extensions list and install the one you like

  • @a.anvarbekov
    @a.anvarbekov ปีที่แล้ว +1

    This was a desired update for the older video! Could you brother make a deployment tutorial as a next step for this, please?

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว +1

      There’s a lot of ways to deploy a node app but definitely something I’d like to cover at some point

  • @eugenematsetska8406
    @eugenematsetska8406 4 หลายเดือนก่อน

    after this video things with nestjs and typeorm going much better. THANK YOU MARIUS.

  • @jennifferorjuela947
    @jennifferorjuela947 ปีที่แล้ว

    I'm working with providers for that conexion data getting from configService, but I can make connect to the database. Can anyone help me, pls?

  • @simpsomk
    @simpsomk 11 หลายเดือนก่อน

    10:45 why do we need to use create method of repository before saving?

    • @mariusespejo
      @mariusespejo  11 หลายเดือนก่อน

      Save only works on actual instances of an entity

  • @amerhamed1729
    @amerhamed1729 3 หลายเดือนก่อน

    Please Help after update the entities add colum or update name and try to run generate it give me create not alter and when i use migration:run i get sql error this table is already exist

    • @mariusespejo
      @mariusespejo  3 หลายเดือนก่อน +1

      Make sure your datasource config is setup properly. Generally how generate command works is it connects to your DB to figure out current schema, and compares it to your local entities to understand the diff. If your generate results in CREATE commands, that likely means you are connecting to a database where the tables were not yet created. Also you are still in full control of the SQL, if generate results in incorrect SQL you should correct it

    • @amerhamed1729
      @amerhamed1729 3 หลายเดือนก่อน

      @@mariusespejo i use "paths": {
      "@/*": ["./src/*"]
      } as config in ts config file can be this problem

  • @permanar_
    @permanar_ 2 ปีที่แล้ว

    Finally my favs TH-camr!! I've been waiting for your new damn videos like every day, week, month 😭😂
    Whatever it is, it's just glad I've seen your channel seems like not getting hacked! Haha.
    Cheers mate!

  • @moezfazzi8337
    @moezfazzi8337 ปีที่แล้ว

    thank you for the video please what is the extension of vs code to see the db

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      Sorry, I don’t remember the name of it, I’m sure if you search for database or sqlite viewer it will show up

  • @zackOverflow
    @zackOverflow ปีที่แล้ว

    WOW!!! you killed it in just 28 minutes, I am a big fan. I love the accent, I love the swag. Everything is FANTASTIC!!! 👍💥

  • @ronelcabrera5191
    @ronelcabrera5191 7 หลายเดือนก่อน

    github source?

  • @BRP-Moto-Tips
    @BRP-Moto-Tips ปีที่แล้ว

    nice. thanks!

  • @nash-u6f
    @nash-u6f ปีที่แล้ว

    Hi. I prefer the theme you are using! Which theme of editor and icon are you using?

  • @muawallaceewi8410
    @muawallaceewi8410 10 หลายเดือนก่อน

    Super amazing clear tutorial, thanks very much for the great job done

  • @TheBrownBox
    @TheBrownBox 2 ปีที่แล้ว

    Hi @marius, Thank you so much for the tutorial, but may I ask what font that you're using? :D
    Thank you very much!

    • @mariusespejo
      @mariusespejo  2 ปีที่แล้ว +1

      My default font at the moment is cascadia mono, it’s the same as cascadia code but without ligatures. It’s a free font check it out!

    • @TheBrownBox
      @TheBrownBox 2 ปีที่แล้ว

      @@mariusespejo THank you for your response!

  • @sarunmrzn
    @sarunmrzn ปีที่แล้ว +1

    Hey Marius, great vid. I'm configuring migration for my own project and I'm stuck in this one thing.
    I've configured database object with config service, which works great in application, but for the migration cli, i cant seem to find a way to get env vars with config service, do you have idea how?

    • @sarunmrzn
      @sarunmrzn ปีที่แล้ว +1

      the above doesn't work and the variable are undefined

    • @sarunmrzn
      @sarunmrzn ปีที่แล้ว +1

      const configService = new ConfigService();
      const dataSource = new DataSource(databaseConfig(configService));
      export default dataSource;

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว +1

      hey Sarun, I don’t think the ConfigService is designed to run outside of Nest, which migrations are kind of a standalone thing if you think about it. You can install dotenv directly (which is what configservice likely uses under the hood) then just access your env variables via process.env

    • @sarunmrzn
      @sarunmrzn ปีที่แล้ว +1

      @@mariusespejo Yep, apparently so. Was just wondering if there was a workaround without installing new package. Thank you so much for this!

  • @purushothamag3898
    @purushothamag3898 ปีที่แล้ว

    Very very informative please made video on dataseeder

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      Typeorm doesn’t directly support seeding, you can use migrations to pull it off or a 3rd party tool

  • @NursultanBegaliev
    @NursultanBegaliev 6 หลายเดือนก่อน

    Thank you!

  • @abolfazljalildoost766
    @abolfazljalildoost766 ปีที่แล้ว

    please also make a *Microservices with Rabbitmq* tutorial , thank you

  • @muratasarslan2359
    @muratasarslan2359 ปีที่แล้ว

    Thank you, it's very helpful. github repo for this app?

  • @sithumdilshan5878
    @sithumdilshan5878 ปีที่แล้ว

    thank you

  • @gptwisdomtalks
    @gptwisdomtalks 2 ปีที่แล้ว

    Welcome back , waiting for your microservices tutorials

  • @IrshadahmedJakati
    @IrshadahmedJakati ปีที่แล้ว

    Nice!

  • @ugudango
    @ugudango ปีที่แล้ว

    I've used TypeORM in production for a while, and all I can say is that it's surprisingly disappointing.
    Of course, this is all entitled speech, after all it's free, and it's the labour of many people. But I just can't fathom how can there be so many regressions, documented features that simply don't work, and unexpected behaviors.
    Having used Eloquent in the past, TypeORM does the complete opposite of what an ORM is supposed to.
    The cases where I've had to think "Ok, how do I write this SQL so that it's compatible with TypeORM?" are just too many. With Eloquent, for example, I had the luxury of even forgetting some SQL.
    All in all, I haven't really found something that cuts it. MikroORM is the closest contender, but that too doesn't have basic features such as soft deletion. Prisma is great, but it still has some missing features that force me to rethink the architecture.
    If only there was an Eloquent typescript implementation... Oh well.

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      Yeah I totally would agree. To be honest they kind of dropped the ball with the 0.3 upgrade… they should have made it a major version bump, and the docs for the CLI are just straight up wrong (lots of github issues trying go figure out how to do migrations now, part of why I wanted to cover it). I’d probably use prisma on new projects if it was me, but not familiar with eloquent or mikro.

  • @okeyshourovroy2769
    @okeyshourovroy2769 ปีที่แล้ว

    How to do distance based search or geoquery in typeorm?

  • @heisenbergyt49
    @heisenbergyt49 ปีที่แล้ว +1

    +1 for QueryBuilder..

  • @KhoiNguyen-pm2jg
    @KhoiNguyen-pm2jg ปีที่แล้ว

    Hello bro, thank you for your tutorial.
    I have a question, how can i create a migration using migration:create?
    I tried add "migration:create": "npm run typeorm -- migration:create", to package.json, but it not work. It throw the message "Unknown argument: d"

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      That means you didn’t provide the path to the datasource file. Take a look at how I have the typeorm script in the video

  • @vibekdutta6539
    @vibekdutta6539 2 ปีที่แล้ว

    I needed that omgggggg. Been watching ur vdos recently and my migrations were failing. Thanks a ton

  • @samrat131
    @samrat131 ปีที่แล้ว

    hi, how to use process.env.DB_HOST ... others env value in data-source.ts file? because when I use it shows undefined ! please help. thanks

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      You need to use the ConfigModule or you can use dotenv directly to populate those values for you. Basically have that environment variable actually filled and available by the time your app runs

  • @kheangchea5689
    @kheangchea5689 ปีที่แล้ว

    Thank you for your great video ! I have got questions . How can I config DataSourceOption that get value using .env ?

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      For nest specifically you would use the ConfigService for that, which needs to be injected so you need to do .forRootAsync for the typeorm module

  • @fareedezzedeen8017
    @fareedezzedeen8017 ปีที่แล้ว

    Thank for your unique contents and your excellent way to transfer knowledge.
    My concern about typeORM is how you trust a library when it's code repository has 1.7K open issues?
    Thank you again

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว +4

      Any reasonably popular open source project will have a lot of issues unless it’s backed by a good size dedicated team. For example a more modern alternative that I’d recommend also checking out is prisma. And even that has double the issues. Personally I’ve used typeorm in production enough that I think it’s a reasonable solution that works great with Nest. But nothing is perfect, you have to decide what tradeoffs you’re comfortable with.

  • @Medivelias
    @Medivelias ปีที่แล้ว

    Hi Marius, thanks for your tutorial, it helped a lot! I was wondering which masOS terminal you were using?

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      That’s just iterm, but I use things like oh-my-zsh to add basic plugins like syntax highlighting and autocomplete. I’ve also been trying out Warp recently, check it out!

  • @AbhinavKulshreshtha
    @AbhinavKulshreshtha ปีที่แล้ว

    What would a good way to make this migration use .sql file for first import, instead of writing commands directly.

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      Don’t think it’s designed to work with sql files directly, just copy your sql into an initial migration file

  • @bayalesko7956
    @bayalesko7956 ปีที่แล้ว

    Great content and quality is up level. I knew you with this video @Marius Espejo and now wait new videos :) Great job!

  • @ShadabIqbal-n2g
    @ShadabIqbal-n2g ปีที่แล้ว

    I have watched your nestjs crash course in netninja's channel and from there, headed straight to your channel to learn typeorm. You have explained both of these concepts really really well. I have been a fan of yours, I would say. Thank you.

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      Thanks! Glad you’re finding the channel useful

  • @Pedro21Torres
    @Pedro21Torres 2 ปีที่แล้ว

    Glad to see you back, thanks for that video!

  • @ВасилийКоннов-е2х
    @ВасилийКоннов-е2х ปีที่แล้ว

    Красавчик!) Хоть где-то нашелся рабочий пример! Перед этим я перерыл уйму статей и форумов.

  • @Unifono2012
    @Unifono2012 ปีที่แล้ว

    Great tutorial, thank you!

  • @vsevolod_zorin
    @vsevolod_zorin ปีที่แล้ว

    Oh man, thank you so much! Your work was not in vain. I wish you peace and goodness!

  • @aleksazivkovic2792
    @aleksazivkovic2792 ปีที่แล้ว

    I would like a deeper dive honestly

  • @mateusz6260
    @mateusz6260 2 ปีที่แล้ว

    Thank You for come back.🥳🙂

  • @emmanuelawolusi9343
    @emmanuelawolusi9343 ปีที่แล้ว

    this helped a lot... thank you

  • @loiskouninef5014
    @loiskouninef5014 ปีที่แล้ว

    Just want to say a huge THANK YOU.
    Navigating through your NestJS videos (and, of course, official documentations) really helped me understand the framework and build basic APIs with Postgresql.
    Can't wait to see what's up next!
    Again, thank you and keep up the good work :)

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      You’re welcome! Thanks for stopping by to comment 🙂

  • @afrosso
    @afrosso ปีที่แล้ว

    Hi, why you don't use async/await in userService?

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      Unless you actually need to await the response and further process it before returning, there’s no need to. Nest will automatically “unwrap” your promises for you

  • @didierngabouwayo8424
    @didierngabouwayo8424 ปีที่แล้ว

    nice and simple explanation thanks, can you cover how to generate a custom auto-incrementing primary keys in typeorm such as CUST_0001?

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      I think to pull that off you’d have to use entity listeners which allows you to add @BeforeInsert logic where you can do things like generate your own keys, add custom timestamps etc

    • @lugadev97
      @lugadev97 ปีที่แล้ว

      You could create a sequence into a migration (remember the revert command into drop method) and request the sequence's next value throw typeorm query API.

  • @asmaakhalidy3775
    @asmaakhalidy3775 ปีที่แล้ว

    Yes, could you please make us a video about query builder 🙏!

    • @asmaakhalidy3775
      @asmaakhalidy3775 ปีที่แล้ว

      I wanna thank you for your very helpful videos 😊.

  • @beatrizpatricio9892
    @beatrizpatricio9892 ปีที่แล้ว

    working fine thank you

  • @bombrman1994
    @bombrman1994 ปีที่แล้ว

    do you have anything related to mongodb/mongoose etc how to use it with nestjs do we use it with typeorm. I am looking for some details and guidance at least minimal

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      Not at the moment. Nest does have docs on using mongo and mongoose, have you already looked at that? Although typeorm does also support mongo, I’m not sure why you’d use that over mongoose.. unless you have a need to connect to both mongo and a relational DB and want to use the same tool for both

    • @bombrman1994
      @bombrman1994 ปีที่แล้ว

      @@mariusespejo thank you for clarifying it, I was not sure if they are a must to be used together or just some special cases. I just have a regular case where I need one of them. TypeORM was easy I followed you and now I’m digging MongoDB separately trying to get it work.

  • @emadzaheer
    @emadzaheer ปีที่แล้ว

    Flawlessly explained!

  • @masadamsahid
    @masadamsahid ปีที่แล้ว

    Great tutorial, Marius. Big thanks
    But, how to enable .env variables in the db/data-source.ts?
    Of course we dont want to push our DB configuration to Github repo right?

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว +1

      Just like how you would in any node app, use process.env to access environment variables. You can also initialize a connection using TypeOrmModule.forRootAsync() which allows you to pass in either a class or a factory, both of which can inject the ConfigService (which parses values from .env, it’s basically dotenv)

    • @masadamsahid
      @masadamsahid ปีที่แล้ว

      ​@@mariusespejo Oh, yeah. You're right. I think it's because of my own mistake. 😅
      I didn't import the 'dotenv' module properly using the asterisk symbol and 'as' keyword.
      The way I imported 'dotenv' before:
      import dotenv from 'dotenv'; // Not working. Bad ❌
      The right way I should did:
      import * as dotenv from 'dotenv'; // Worked successfully. Good ✅
      I dont know why both of them have different results. The first way is usually works fine in other Node projects, but does not work successfully in a Nestjs project.
      Anyway, big thanks for your tutorials and advices, Marius. 👍

    • @mariusespejo
      @mariusespejo  ปีที่แล้ว

      Already gave notes above, take a moment to try and figure it out 🙂. If you rely too much on tutorials it’ll just limit your own growth. Take the time to trial & error

  • @porbaixodospanos8989
    @porbaixodospanos8989 ปีที่แล้ว

    please don't stop

  • @phimngantiengthai
    @phimngantiengthai ปีที่แล้ว

    Worked, thx