-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
[16.0][IMP] edi_storage_oca: Add script to migrate to v16 #95
base: 16.0
Are you sure you want to change the base?
[16.0][IMP] edi_storage_oca: Add script to migrate to v16 #95
Conversation
967b6c1
to
8977c4f
Compare
@etobella would you be able to test this in real life? |
FTR I doubt we should not 😉 |
That is not true. We could define information directly on the storage. this information needs to be ported too |
return | ||
|
||
required_modules = ("storage_backend", "edi_storage_oca") | ||
if not env["ir.module.module"].search( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you don't need this verificatiion. If you are in this script, you come from 15, so storage_backend
is installed
|
||
def _create_fs_storage_records(env): | ||
# Create a fs.storage record for each backend.storage | ||
storage_backend_records = env["storage.backend"].search([]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should only transform the backends that come from edi.backends. Probably we need to add some SQL here, but it is the cleaner option IMO
[("name", "in", required_modules), ("state", "=", "installed")] | ||
): | ||
return | ||
if not openupgrade.column_exists(env.cr, "edi_backend", "new_storage_id"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to avoid the create new column, change column to old and new to current you can do:
_column_renames = {
"edi_backend": [
("storage_id", False), ],
}
openupgrade.rename_columns(env.cr, _column_renames)
create_column(env.cr, "edi_backend", "storage_id", "int4")
The old field will have the following name: openupgrade.get_legacy_name("storage_id")
Hi @simahawk precision about that point:
of course some people might decide to migrate them, like |
Context:
storage_backend
will still be installed in the old db and that we simply have to create the matchingfs.storage
records w/ their conf leaving the old storage.backend records untouched.Notes:
Put this script to
16.0.1.0.0
because of changing storage_backend to fs_storage, if we put it to the later versions, the storages in backends have been changed, so can't link to the mapping records infs.storage
storage_backend_ftp
andstorage_backend_s3
have not been migrated to 16.0 (and should not)storage_backend
depends onserver_environment
cc @simahawk @etobella