The only tutorial I found which uses entity to create migrations flawlessly
@googleaccount13382 жыл бұрын
Is this a current solution? The documentation mentions creation via DataSource.
@matkoklaic2 жыл бұрын
You are right, this is not a current solution.
@amitavroydev Жыл бұрын
For the latest version look at the recent video that I have posted. In the new version of TypeORM where datasource is introduced, things have changed and I have captured that. kzbin.info/www/bejne/iqrCi6ZorJh-j9E
@jhvhest2 жыл бұрын
Your video is the first one that really helped in getting migrations to work. Thnx!
@amitavroydev2 жыл бұрын
Thanks for the comment and good to know that it helped
@adenaziz36002 жыл бұрын
i've got error on typeorm.config.ts, it's said "Object literal may only specify known properties, and 'cli' does not exist"
@adenaziz36002 жыл бұрын
i've solved it. You are using version 0.2.45 while i'm using the latest version, so i have to downgrade first.
@labaks48442 жыл бұрын
@@adenaziz3600 what are downgrading? typeorm? UPDATE: downgraded as you mentioned and the error was gone.! thanks!!
@amitavroydev Жыл бұрын
Yes the version thing is very important
@nehagadhavi5754 Жыл бұрын
migrations: [__dirname + '/../database/migrations/*{.ts,.js}'], migrationsRun: true, migrationsTableName: 'typeorm_migrations', charset: 'utf8mb4_unicode_ci', update with these changes
@tarunnagia63272 жыл бұрын
Hi, I'm getting error in related to cli with latest version, what should I do?
@amitavroydev2 жыл бұрын
Yes, there are major changes in TypeORM
@eduardokiriakos62552 жыл бұрын
@@amitavroydev I have had a headache for three days due to these changes! There is still very little info about dataSources
@amitavroydev2 жыл бұрын
Yeah, I tried as well but the docs are not very clear. I am not able to upgrade the orm version. And it breaks at a point saying it's looking for a db driver which i am not even using
@eduardokiriakos62552 жыл бұрын
@@amitavroydev I found a useful tutorial about this! It's in Spanish but it has link to the Github Repo. kzbin.info/www/bejne/m2eug3mIZ7Clopo -- the part two shows how to setup migrations using the dataSource!
@sarunmrzn2 жыл бұрын
@@amitavroydev any update on this?
@mdtowhidulislam52602 жыл бұрын
cli: { migrationDir: __dirname + '/../migrations', }, this part is not working on 09:01 ...can someone tell me how to solve this??? and maybe for this reason I am getting an error - Missing required argument: dataSource when run the command npm run typeorm:cli migration:show
@amitavroydev2 жыл бұрын
can you check if the typeorm version is matching your pckage.json version? I know in recent version things have changed a bit
@mdtowhidulislam52602 жыл бұрын
@@amitavroydev my typeorm version is 0.3.10
@antonpavlovich48802 жыл бұрын
@@mdtowhidulislam5260 you need to pass file with exported dataSource object
@antonpavlovich48802 жыл бұрын
@@mdtowhidulislam5260 with 0.3.10 typeorm version we don`t need to pass this CLI object, all we have to do is pass two argument: 1 -d (path to file with exported dataSource object) 2 -n (path to migration dir included the name of migration without extension)
@yohanespradono5224 Жыл бұрын
i have set "synchronize": false in ormconfig.json but nestjs keeps creating/syncing the table schema
@amitavroydev Жыл бұрын
May be it's not using the JSON file. Can you do it inside the Module's config?
@raneanish212 жыл бұрын
cli in migrations is deprecated is there any other way to include cli property? in typeormmoduleoptions?
@amitavroydev2 жыл бұрын
Yes Anish, I have seen that. I need to try that out. I haven't done that yet. My team also haven't explored that.
@SantoshKumar-uw5cg Жыл бұрын
I am getting 'Missing required argument: dataSource' on npm run typeorm:cli migration:show
@amitavroydev Жыл бұрын
Will check
@SantoshKumar-uw5cg Жыл бұрын
@@amitavroydev FYI I am trying to implement migrations in nestjs microservices app with a multi-tenant architecture
@labaks48442 жыл бұрын
did anyone get this error?? "No repository for "UserRepository" was found. Looks like this entity is not registered in current "default" connection?"
@amitavroydev2 жыл бұрын
That's a strange error. Is your basic DB connection working?
@muhammadsadiq36532 жыл бұрын
@Labaks, when you're getting this is mostly because you haven't added your entity or repository to it's module
@Brunodelucasdev2 жыл бұрын
After run migration i receive "Error during migration generation:" and stack of errors! why solve this?
@amitavroydev2 жыл бұрын
What's the issue? It must be failing complaining about something. Without knowing that, it's very difficult to say that could be the problem.
@muhammadsadiq36532 жыл бұрын
Has anyone figured out yet how to migrate using typeorm 0.3.x basically everything I'm doing isn't working
@ravenpl73662 жыл бұрын
i have spent last 2 days looking for solution but didnt find it. Every tutorial, info is for
@amitavroydev2 жыл бұрын
Believe me, I tried twice but still couldn’t get everything to work smoothly
@svetoslavhristov7892 жыл бұрын
kzbin.info/www/bejne/raCwgaFpg9Jml6M solution
@muhammadsadiq36532 жыл бұрын
Tried running "typeorm:cli" but i'm getting "Error: Unknown or unexpected option: -f". I believe the -f flag means this "src/config/typeorm-migrations.config.ts" is a file, don't get why it isn't working
@amitavroydev Жыл бұрын
Have you executed typeorm:config?
@nealfarrand12462 жыл бұрын
Amazing. Thank you so much for this updated tutorial that works.
@amitavroydev2 жыл бұрын
Thanks for the comment Good to know you found it useful
@gillesashley93142 жыл бұрын
Yes, I agree, I'm coming from a Laravel background and migration is a first-class citizen as your said, super easy. My question is, why can't the nest team make migration a first-class citizen like Laravel. I tried leaning nest but couldn't cope with the migration and seeding configurations. Had to continue using Laravel.
@amitavroydev2 жыл бұрын
Well, it's difficult to say but I think because Nest support so many ORMs, this problem exist. Every ORM has a different configuration. Like for mongo you need mongoose, but for relational you need to use typeorm or prisma. Laravel on the other hand has it's own ORM which is a big advantage. So, they are able to support multiple databases without changing the ORM.
@Андрюхаслазерки2 жыл бұрын
Nice, very nice video. Thank you very much!!!!!
@amitavroydev2 жыл бұрын
Good to know you liked it. Cheers
@ashiqdey2 жыл бұрын
teaching is good, but I am wondering why you code in light mode, doesnt it hurt eyes?
@amitavroydev2 жыл бұрын
No, actually it never hurts. On the contrary I try to be on light mode because the shift from Dark mode to light mode when working on web apps is a nightmare. You are developing an app / client project which is not following a dark theme - then suddenly your code editor is dark and the browser it white. That suddent and drastic shift in color is actually irritating.
@markzabana2 жыл бұрын
I tried to use this concept in my project but it isn't working. In 'typeOrmConfig' can't get any value from process.env like you do. How can I do ?
@amitavroydev2 жыл бұрын
That's strange because process.env is something which is available by default. You are facing issue during development or only on production?
@abolfazlroshanzamir13222 жыл бұрын
Hi, your teaching is great. Where can I download the source of your project?
@amitavroydev2 жыл бұрын
Here github.com/amitavdevzone/nest-js-quiz-manager
@tuanvominh32192 жыл бұрын
Thank you so much. 😁😁😁
@amitavroydev2 жыл бұрын
Welcome
@KhoiNguyen-pm2jg2 жыл бұрын
TS2322: Type '{ type: "mysql"; url: string; entities: string[]; migrations: string[]; cli: { migrationsDir: string; }; extra: { charset: string; }; synchronize: true; autoLoadEntities: true; logging: boolean; }' is not assignable to type 'TypeOrmModuleOptions'. Object literal may only specify known properties, and 'cli' does not exist in type '{ retryAttempts?: number; retryDelay?: number; toRetry?: (err: any) => boolean; autoLoadEntities?: boolean; keepConnectionAlive?: boolean; verboseRetryLog?: boolean; } & Partial'. I get an type error in typeorm.config.ts. Can you help me?
@amitavroydev2 жыл бұрын
When exactly is this problem coming?
@KhoiNguyen-pm2jg2 жыл бұрын
@@amitavroydev at 8:34, when i copy your code, i get that error
@KhoiNguyen-pm2jg2 жыл бұрын
@@amitavroydev i'm using typeorm version 0.3.7
@KhoiNguyen-pm2jg2 жыл бұрын
@@amitavroydev hey bro, can you help me :((
@anirudhhosur38276 күн бұрын
All your videos were awesome until now :/ I watched this video 2-3 times (the starting half). I still am getting confused as to different config files with ConfigAsync and ConfigAsyncOptions, etc. Its confusing now! I have understood why migrations are important. Thanks for the intro.
@amitavroydev6 күн бұрын
The two configs were required because the way typeorm is available on the cli. So i had to create two different configs. One for cli and the other for normal. In the new version though things have changed
@jackfrost8969 Жыл бұрын
so now you magically switched from postgres to mysql
@amitavroydev Жыл бұрын
It's an ORM, so not much change in the logic honestly.
@jackfrost8969 Жыл бұрын
@@amitavroydev then why did you switched them? There is not much issues apart from one where I can't disable the foreign check constraint before truncating the table used while preparing for seed data. SET foreign_key_checks = 0 this only works in mysql, for postgres I have still not found any working solution for it. I have tried changing the replication role, disabling the triggers to no avail.
@rudeadyet1992 Жыл бұрын
this tuto is too old my friend. typeorm >=0.3 need datasource for migration
@amitavroydev Жыл бұрын
Yes you are right about this. The video is almost a year old. At that time, Typeorm was on 0.2.x And now, the latest one is 0.3.x