mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-24 16:48:36 +00:00
Migrate attachments s3 to new pattern
So remove the compatibility code altogether
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2016 Camptocamp SA
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||
|
||||
import os
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
cr.execute("""
|
||||
SELECT value FROM ir_config_parameter
|
||||
WHERE key = 'ir_attachment.location'
|
||||
""")
|
||||
row = cr.fetchone()
|
||||
bucket = os.environ.get('AWS_BUCKETNAME')
|
||||
if row[0] == 's3' and bucket:
|
||||
cr.execute("""
|
||||
UPDATE ir_attachment
|
||||
SET store_fname = 's3://' || %s || '/' || store_fname
|
||||
WHERE store_fname IS NOT NULL AND store_fname NOT LIKE '%%/%%'
|
||||
""", (os.environ['AWS_BUCKETNAME'],))
|
||||
Reference in New Issue
Block a user