Repository navigation
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1847 +/- ##
==========================================
- Coverage 26.52% 26.50% -0.02%
==========================================
Files 377 380 +3
Lines 27448 27668 +220
==========================================
+ Hits 7281 7334 +53
- Misses 19503 19642 +139
- Partials 664 692 +28 ☔ View full report in Codecov by Sentry. |
|
Deployment of preview was successful: https://woodpecker-ci-woodpecker-pr-1847.surge.sh |
|
Should migrations also be run for old database? |
|
@lafriks yes in import, migration only will run on old database. If we want to change that, we would have to have a copy of the models for each schema we had in the past |
|
Also this help us to drop quirks that might existing in old databases as we init the schema on the new db as if it was a new install and then just copy data that fits in the current models |
qwerty287
left a comment
There was a problem hiding this comment.
Yeah OK that's valid. I still prefer a generic tool but if you really think that's a good addition...
Can you move the code as far as possible to its own module? Not directly in migrations, rather something like migrations/dbms
| } | ||
|
|
||
| // copy data | ||
| // IMPORTANT: if you add something here, also add it to migration.go allBeans slice |
There was a problem hiding this comment.
Please resolve this todo.
Actually I don't really get why this needs to be done with generics. In the end, it seems that you only use this type to:
- Use
new(T)which can be directly replaced by the value which is also inallBeans - Create the list to run xorm
Find.
AFAIK xorm supports setting a table explicitly so it might be possible to use an any type for the second case but setting the table explicitly using the value from allBeans?
There was a problem hiding this comment.
sadly this wont work, i tried hard to ose the any type ... or reflections.
but i could not create a list of items based on any ... if i dont batch and itterate over each item by one it might work ... but that is sure inefficient!
There was a problem hiding this comment.
OK, I get what you mean, tried it as well. Can you ask xorm about this? I'd like to have this fixed first.
There was a problem hiding this comment.
xorm per se can not do anything ... it would have to add an Database-Migration-Feature.
that will work
There was a problem hiding this comment.
There was a problem hiding this comment.
I don't want them to implement something like this, just that you can use Find with []any would help a lot
There was a problem hiding this comment.
the problem is that then you have to validate each item in the list ... that slows down the whole orm!
I would actually prefer to put it in a separate repo as a separate cli tool as well. |
|
now it's code generated so there should be no problem with maintenance burden |
|
I'd still prefer this in a separate tool, it shouldn't be a problem to import WP's models. This is not a task that's done often I think |
|
well the "separate tool" is currently this pulls preview images ... witch I use for my migrations. If one does pick it up and make a nice tool then this one should do so. |
|
So you don't plan to get this merged into main? In this case, I'd rather use a separate docker repo and close this pr |
|
well I personally do wana get it merged ... but there is no majority for it |
|
Yes, so we probably won't merge it. Then the PR should be closed and this tool can live in a separate branch, but not in a PR. |
|
well that's as majour as the build-in function could go. as everybody want to just have an external tool ... well I did the migrations I had to. |
close #924