-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
db: proper one-off migration support #1784
Comments
Like I said. I'm not a surprised Pikachu. |
So, as seen in an attempt (PR #2317), RequirementsBefore going further, here is a list of requirements that I think we should have:
Sopel command lineI suggest a new command named We could have code to either auto-run migration or print a warning when running Sopel without having the appropriate migration (indicating to run Generate new migrationsGenerating migrations is a bit more difficult: only Sopel developers must generate migrations, and put them in the right place. For that, we can consider have a separate I think we can still use Running migrationsA bot owner must be able to run database migration just by using a command, either directly by running I think this is pretty straightforward, and it's the reason why we need a specific command (or sub-command). There are, however, two cases to consider first:
Generate plugin migrationsThis part is probably the most complex. I think it's fair to set some limitation:
We can take advantage of various features of Alembic (which need to be analyzed and tested), such as having multiple named alembic config, using multiple location for script/revision with a single Alembic env, etc. Run plugin migrationsOnce again, this shows why we need to act as a proxy on top of Alembic commands, because only Sopel knows where the plugins are, and so their migrations. On the other side of the problem, I wonder how a plugin could advertise their migrations: convention? Entry point configuration? I'm still not sure on that one, but I'm sure I'll figure something out. |
Bumping to next major version for reasons described in #2293 (comment) |
Database schema changes happen. Not only that, but sometimes the meaning of a column changes slightly between releases (e.g. #1744).
Sopel could use a system to run needed migrations once-and-only-once on a given database. This probably means storing a "schema version" number/flag somewhere, and writing migration functions to run if the version is too low (or, for the first ones, nonexistent).
I am very optimistically tagging this for 7.1… If it happens before 8.0, I'll be a surprised Pikachu.
The text was updated successfully, but these errors were encountered: