Have `MigratorTrait` use `self`
Motivation
Defining migrations, it is sometimes handy to have additional information, coming through configuration or other means of passing runtime information.
However, as MigratorTrait's migrations function doesn't have a self, that is rather tricky.
Proposed Solutions
Add &self to MigratorTrait functions. So this can be used, if required.
Additional Information
right, I see what you mean. however this is a backwards-incompatible change.
I'll see if I can think of some way to remain backwards compatible.
for now, you can read environment variables from within the migrations function, or use lazy_static
for now, you can read environment variables from within the
migrationsfunction, or uselazy_static
Yes, and that's what I'm doing. But this makes it very hard for tests. Because basically all of this is global. So you can go with tokio's local stuff, but that's all far from optimal.
And yes, I do understand it's a breaking change. Maybe there is a way. But maybe it's a topic for SeaORM 3.0.
we don't have to wait until 3.0 to fix this