New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migration guide from v0.2.x to v0.3.x #9286
Comments
|
Thanks @needim , very valuable! |
|
Thank you @needim for this great guide. |
|
Has anyone noticed when upgrading that default join table names changed from UPDATE: What I ended up doing to address this change in default join table names was the following:
If everything is working, you can probably merge the manual table name migration with the auto-generated one since these need to happen at the same time. But you'll have to be sure to revert anything you ran before merging them and then re-run the merged logic. If anyone has a better solution/answer, I'll still be curious of course. UPDATE 2: That doesn't seem to have fully worked as I expected. It seems to still be looking for the |
|
There is an issue what if we wanna give the migration name as an argument without the file path to migrations ? We can't do this according to the above implementation |
|
I wrote some codemods to perform this migration. See https://dev.clintonblackburn.com/2023/07/15/upgrading-typeorm-with-jscodeshift for more info. |
|
@needim Thanks for this comprehensive guide on migrating. Has anyone had any issues with generating migrations after following these steps. When I run the CLI commands given I get the error:
|
I know this is not a feature request but maybe this issue can help other people to upgrade. Because I see a lot of people struggling with version update to v0.3.x from v0.2.x.
I finally managed to update our codebase for v0.3.x and wanted to share some paths I followed.
I had to move all custom repositories to independent services which are using plain repositories. No use for custom repositories anymore. (I don't like it but ok)
I had to create my own DataSourceManager (for replacement of ConnectionManager in v0.2.x) because we are using multitenant DB structures, on the fly creating data sources and destroying them if necessary.
data-source.ts
For CLI I had to export some default dataSources from my own DataSourceManager in seperate files.
package.json old
package.json new
3.1. Migration run, generate, seed commmands had to change.
for default context from:
changed to:
for company context from:
changed to:
data-source-admin.ts (new file which is used for admin context migration cli)
data-source-company.ts (new file which is used for company context migration cli)
And I had to convert old usages to new usages. Here are some regex replacers I used for in VSCode:
And also I did a lot of manual changes in the codebase for new usages
The text was updated successfully, but these errors were encountered: