Skip to content
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

New template: migration #36

Open
ThomasBinsfeld opened this issue Oct 7, 2019 · 4 comments
Open

New template: migration #36

ThomasBinsfeld opened this issue Oct 7, 2019 · 4 comments

Comments

@ThomasBinsfeld
Copy link
Member

What about a new migration template that would generate migration script for a given module?
When being in the current module's directory: mrbob bobtemplates.odoo:migration

It would ask for:

  • new module version
  • use openupgrade? (yes/no)
  • pre-migrate? (yes/no)
  • post-migrate? (yes/no)

And then it would:

  • generate the migrations/{version_number}/(pre/post)-migrate.py file(s)
  • import logging and add a default _logger.info() message in the migrate method
  • if the use of openupgrade is selected:
    • import openupgrade
    • add the @openupgrade.migrate(use_env=True) decorator and use the env variable in the migrate method
    • add openupgradelib to the external dependencies of the manifest
  • change the version of the module accordingly

If it's relevant, the same could be done for pre/post-init hooks (I can write a separate issue for that).

@sbidoul
Copy link
Member

sbidoul commented Oct 7, 2019

+1, good idea

@blaggacao
Copy link
Contributor

+1, very nice! I haven't implemented bob template yet, but it's on the road-map and I'd love such feature.

@bmessiaz

This comment has been minimized.

@sbidoul

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants