File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed
openupgrade_scripts/scripts/mail/15.0.1.5 Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -170,13 +170,12 @@ def migration_to_mail_group(env):
170170 ("mail_channel_moderator_rel" , "mail_group_moderator_rel" ),
171171 ],
172172 )
173- openupgrade .rename_columns (
173+ openupgrade .logged_query (
174174 env .cr ,
175- {
176- "mail_group_moderator_rel" : [
177- ("mail_channel_id" , "mail_group_id" ),
178- ]
179- },
175+ """
176+ ALTER TABLE mail_group_moderator_rel
177+ ADD COLUMN mail_group_id integer
178+ """
180179 )
181180 # fill mail_group table
182181 sql .create_model_table (
@@ -234,7 +233,16 @@ def migration_to_mail_group(env):
234233 UPDATE mail_group_moderator_rel rel
235234 SET mail_group_id = mg.id
236235 FROM mail_group mg
237- WHERE mg.old_channel_id = rel.mail_group_id""" ,
236+ WHERE mg.old_channel_id = rel.mail_channel_id""" ,
237+ )
238+ openupgrade .logged_query (
239+ env .cr ,
240+ """
241+ ALTER TABLE mail_group_moderator_rel
242+ DROP COLUMN mail_channel_id;
243+ DELETE FROM mail_group_moderator_rel
244+ WHERE mail_group_id IS NULL;
245+ """
238246 )
239247 # fill mail_group_moderation.mail_group_id (field is required)
240248 openupgrade .logged_query (
You can’t perform that action at this time.
0 commit comments