-
-
Notifications
You must be signed in to change notification settings - Fork 700
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] website_slides: migrate 15 to 16
- Loading branch information
1 parent
84fa166
commit 8e739c9
Showing
4 changed files
with
245 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
openupgrade_scripts/scripts/website_slides/16.0.2.6/post-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from openupgradelib import openupgrade | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
openupgrade.load_data(env.cr, "website_slides", "16.0.2.6/noupdate_changes.xml") |
107 changes: 107 additions & 0 deletions
107
openupgrade_scripts/scripts/website_slides/16.0.2.6/pre-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
from openupgradelib import openupgrade | ||
|
||
renamed_fields = [ | ||
("slide.slide", "slide_slide", "datas", "binary_content"), | ||
("slide.channel", "slide_channel", "share_template_id", "share_slide_template_id"), | ||
] | ||
|
||
xml_ids_to_rename = [ | ||
( | ||
"website_slides.rule_slide_slide_resource_manager", | ||
"website_slides.rule_slide_slide_resource_downloadable_manager", | ||
), | ||
] | ||
|
||
# slide_slide | ||
|
||
|
||
def create_and_fill_data_from_slide_type_to_slide_category(env): | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
ALTER TABLE slide_slide | ||
ADD COLUMN IF NOT EXISTS slide_category VARCHAR | ||
""", | ||
) | ||
|
||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE slide_slide | ||
SET slide_category = CASE | ||
WHEN slide_type = 'webpage' THEN 'article' | ||
WHEN slide_type = 'presentation' THEN 'document' | ||
ELSE slide_type | ||
END | ||
""", | ||
) | ||
|
||
|
||
def create_and_fill_data_for_source_type(env): | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
ALTER TABLE slide_slide | ||
ADD COLUMN IF NOT EXISTS source_type VARCHAR | ||
""", | ||
) | ||
|
||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE slide_slide | ||
SET source_type = CASE | ||
WHEN url IS NOT NULL AND slide_category = 'document' THEN 'external' | ||
ELSE 'local_file' | ||
END | ||
""", | ||
) | ||
|
||
|
||
# slide_slide_resource | ||
|
||
|
||
def create_column_and_migrate_data_from_slide_link_to_slide_resource(env): | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
ALTER TABLE slide_slide_resource | ||
ADD COLUMN IF NOT EXISTS link VARCHAR, | ||
ADD COLUMN IF NOT EXISTS resource_type VARCHAR | ||
""", | ||
) | ||
|
||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE slide_slide_resource | ||
SET resource_type = 'file' | ||
""", | ||
) | ||
|
||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
INSERT INTO slide_slide_resource ( | ||
name, | ||
link, | ||
slide_id, | ||
resource_type | ||
) | ||
SELECT | ||
name, | ||
link, | ||
slide_id, | ||
'url' | ||
FROM slide_slide_link | ||
""", | ||
) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
openupgrade.rename_fields(env, renamed_fields) | ||
openupgrade.rename_xmlids(env.cr, xml_ids_to_rename) | ||
create_and_fill_data_from_slide_type_to_slide_category(env) | ||
create_column_and_migrate_data_from_slide_link_to_slide_resource(env) | ||
create_and_fill_data_for_source_type(env) |
131 changes: 131 additions & 0 deletions
131
openupgrade_scripts/scripts/website_slides/16.0.2.6/upgrade_analysis_work.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
---Models in module 'website_slides'--- | ||
obsolete model slide.slide.link | ||
|
||
# DONE: move data from slide.slide.link to slide.slide.resource in pre-migration | ||
# REASON: previously website_slides seperate slide.slide.link and slide.slide.resource one is store url another store file. Now combined into slide.slide.resource | ||
|
||
---Fields in module 'website_slides'--- | ||
website_slides / slide.channel / cover_properties (text) : NEW hasdefault: default | ||
website_slides / slide.channel / nbr_article (integer) : NEW isfunction: function, stored | ||
website_slides / slide.channel / nbr_presentation (integer) : DEL | ||
website_slides / slide.channel / nbr_webpage (integer) : DEL | ||
website_slides / slide.channel / share_channel_template_id (many2one): NEW relation: mail.template, hasdefault: default | ||
|
||
# NOTHING TO DO: executed by ORM | ||
|
||
website_slides / slide.channel / share_slide_template_id (many2one): NEW relation: mail.template, hasdefault: default | ||
website_slides / slide.channel / share_template_id (many2one) : DEL relation: mail.template | ||
website_slides / slide.slide / binary_content (binary) : NEW attachment: True | ||
website_slides / slide.slide / datas (binary) : DEL attachment: True | ||
|
||
# DONE: renamed fields in pre-migration | ||
|
||
website_slides / slide.slide / document_id (char) : DEL | ||
|
||
# NOTHING TO DO | ||
|
||
website_slides / slide.slide / embed_ids (one2many) : NEW relation: slide.embed | ||
website_slides / slide.slide / embedcount_ids (one2many) : DEL relation: slide.embed | ||
|
||
# NOTHING TO DO: rename from embedcount_ids to embed_ids still one2many type | ||
|
||
website_slides / slide.slide / link_ids (one2many) : DEL relation: slide.slide.link | ||
website_slides / slide.slide / mime_type (char) : DEL | ||
website_slides / slide.slide / nbr_article (integer) : NEW isfunction: function, stored | ||
website_slides / slide.slide / nbr_presentation (integer) : DEL | ||
website_slides / slide.slide / nbr_webpage (integer) : DEL | ||
|
||
# NOTHING TO DO | ||
|
||
website_slides / slide.slide / slide_category (selection) : NEW required, selection_keys: ['article', 'document', 'infographic', 'quiz', 'video'], hasdefault: default | ||
|
||
# DONE: move value from old slide_type to slide_category in pre-migration | ||
|
||
website_slides / slide.slide / slide_type (selection) : selection_keys is now '['article', 'doc', 'google_drive_video', 'image', 'pdf', 'quiz', 'sheet', 'slides', 'vimeo_video', 'youtube_video']' ('['document', 'infographic', 'presentation', 'quiz', 'video', 'webpage']') | ||
|
||
# NOTHING TO DO: let ORM handle this section because this logic based on field video_source_type and this field computed by external library | ||
|
||
website_slides / slide.slide / source_type (selection) : NEW required, selection_keys: ['external', 'local_file'], hasdefault: default | ||
|
||
# DONE: create column and fill data in pre-migration | ||
|
||
website_slides / slide.slide.link / link (char) : DEL required | ||
website_slides / slide.slide.link / name (char) : DEL required | ||
website_slides / slide.slide.link / slide_id (many2one) : DEL relation: slide.slide, required | ||
website_slides / slide.slide.resource / file_name (char) : NEW | ||
|
||
# NOTHING TO DO | ||
|
||
website_slides / slide.slide.resource / link (char) : NEW hasdefault: compute | ||
website_slides / slide.slide.resource / resource_type (selection) : NEW required, selection_keys: ['file', 'url'] | ||
|
||
# DONE: create column and fill data in pre-migration | ||
|
||
---XML records in module 'website_slides'--- | ||
NEW ir.actions.act_window: website_slides.action_slide_channel_pages_list | ||
NEW ir.actions.act_window: website_slides.slide_channel_action_add | ||
NEW ir.actions.act_window: website_slides.slide_embed_action | ||
NEW ir.actions.act_window: website_slides.slide_slide_partner_action_from_slide | ||
DEL ir.actions.act_window: website_slides.rating_rating_action_slide_channel_report | ||
NEW ir.actions.act_window.view: website_slides.rating_rating_action_slide_channel_view_form | ||
NEW ir.actions.act_window.view: website_slides.rating_rating_action_slide_channel_view_graph | ||
NEW ir.actions.act_window.view: website_slides.rating_rating_action_slide_channel_view_kanban | ||
NEW ir.actions.act_window.view: website_slides.rating_rating_action_slide_channel_view_pivot | ||
NEW ir.actions.act_window.view: website_slides.rating_rating_action_slide_channel_view_tree | ||
NEW ir.actions.act_window.view: website_slides.slide_channel_action_report_view_form | ||
NEW ir.actions.act_window.view: website_slides.slide_channel_action_report_view_graph | ||
NEW ir.actions.act_window.view: website_slides.slide_channel_action_report_view_pivot | ||
NEW ir.actions.act_window.view: website_slides.slide_channel_action_report_view_tree | ||
NEW ir.actions.act_window.view: website_slides.slide_slide_action_report_view_form | ||
NEW ir.actions.act_window.view: website_slides.slide_slide_action_report_view_graph | ||
NEW ir.actions.act_window.view: website_slides.slide_slide_action_report_view_pivot | ||
NEW ir.actions.act_window.view: website_slides.slide_slide_action_report_view_tree | ||
DEL ir.actions.act_window.view: website_slides.rating_rating_action_slide_channel_report_view_graph | ||
DEL ir.actions.act_window.view: website_slides.rating_rating_action_slide_channel_report_view_pivot | ||
DEL ir.actions.act_window.view: website_slides.rating_rating_action_slide_channel_report_view_tree | ||
|
||
# NOTHING TO DO | ||
|
||
DEL ir.model.access: website_slides.access_slide_slide_link_all | ||
DEL ir.model.access: website_slides.access_slide_slide_link_officer | ||
|
||
# NOTHING TO DO | ||
|
||
NEW ir.model.constraint: website_slides.constraint_slide_channel_partner_channel_partner_uniq | ||
NEW ir.model.constraint: website_slides.constraint_slide_channel_partner_check_completion | ||
NEW ir.model.constraint: website_slides.constraint_slide_slide_partner_check_vote | ||
NEW ir.model.constraint: website_slides.constraint_slide_slide_partner_slide_partner_uniq | ||
NEW ir.model.constraint: website_slides.constraint_slide_slide_resource_check_file_type | ||
NEW ir.model.constraint: website_slides.constraint_slide_slide_resource_check_url | ||
|
||
# NOTHING TO DO | ||
|
||
|
||
NEW ir.rule: website_slides.rule_slide_slide_resource_downloadable_manager (noupdate) | ||
DEL ir.rule: website_slides.rule_slide_slide_resource_manager (noupdate) | ||
|
||
# DONE: rename xmlid in pre-migration | ||
|
||
NEW ir.ui.menu: website_slides.menu_slide_channel_pages | ||
DEL ir.ui.menu: website_slides.website_slides_menu_courses_reviews | ||
NEW ir.ui.view: website_slides.course_join | ||
NEW ir.ui.view: website_slides.rating_rating_view_form_slides | ||
NEW ir.ui.view: website_slides.rating_rating_view_tree_slide_channel | ||
NEW ir.ui.view: website_slides.slide_channel_pages_kanban_view | ||
NEW ir.ui.view: website_slides.slide_channel_pages_tree_view | ||
NEW ir.ui.view: website_slides.slide_channel_view_form_add | ||
NEW ir.ui.view: website_slides.slide_channel_view_pivot | ||
NEW ir.ui.view: website_slides.slide_embed_view_search | ||
NEW ir.ui.view: website_slides.slide_embed_view_tree | ||
NEW ir.ui.view: website_slides.slide_sidebar_done_button | ||
NEW ir.ui.view: website_slides.slide_slide_partner_view_form | ||
NEW ir.ui.view: website_slides.slide_slide_partner_view_search | ||
NEW ir.ui.view: website_slides.slide_slide_partner_view_tree | ||
NEW ir.ui.view: website_slides.slide_slide_view_tree_report | ||
NEW ir.ui.view: website_slides.snippet_options | ||
DEL ir.ui.view: website_slides.rating_rating_view_kanban_slide_channel | ||
DEL ir.ui.view: website_slides.slide_edit_options | ||
DEL ir.ui.view: website_slides.user_navbar_inherit_website_slides | ||
NEW mail.template: website_slides.mail_template_channel_shared (noupdate) | ||
|
||
# NOTHING TO DO |