dram.me

Odoo笔记模块数据迁移

本文介绍Odoo笔记模块数据从14.0迁移到14.4(15.0开发版)的流程,基于psql命令实现。

首先进入数据库容器的shell命令行环境,所有psql命令在此环境中执行:

docker exec -it postgres sh

第一步,复制stage数据:

psql odoo-14.0 odoo -c "copy note_stage to stdout" | psql odoo-14.4 odoo -c "copy note_stage from stdin"

第二步,复制attachment数据:

psql odoo-14.0 odoo -c "copy (select * from ir_attachment where res_model = 'note.note') to stdout" | psql odoo-14.4 odoo -c "copy ir_attachment from stdin"

第三步,复制note数据:

psql odoo-14.0 odoo -c "copy note_note to stdout" | psql odoo-14.4 odoo -c "copy note_note from stdin"

第四步,复制note和stage的关联数据:

psql odoo-14.0 odoo -c "copy note_stage_rel to stdout" | psql odoo-14.4 odoo -c "copy note_stage_rel from stdin"

另外,还需要迁移对应的sequence的值。