5 Commits

Author SHA1 Message Date
Stéphan Sainléger
e1d1907cce [NEW] add migration scripts for Odoo 18.0 2025-09-11 10:41:26 +02:00
Stéphan Sainléger
385b9bc751 [NEW] add migration scripts for Odoo 17.0 2025-09-11 10:39:37 +02:00
Stéphan Sainléger
f432b4c75e [IMP] add commented command to launch global addons update at each step of the migration 2025-09-11 10:35:13 +02:00
Stéphan Sainléger
21028149be [IMP] update postgres version to 17.2.0 2025-09-11 10:33:39 +02:00
Stéphan Sainléger
972e6c7b26 [FIX] add su access for filestore manipulation 2025-09-11 10:31:52 +02:00
13 changed files with 70 additions and 33 deletions

View File

@@ -0,0 +1,5 @@
#!/bin/bash
echo "Post migration to 13.0..."
#compose --debug run ou13 -u base --stop-after-init --no-http

View File

@@ -17,20 +17,6 @@ EOF
)
query_postgres_container "$PRE_MIGRATE_SQL" ou13 || exit 1
# Digital currency specific - to comment if not needed
INVOICE_NAME_SQL=$(cat <<'EOF'
ALTER TABLE credit_request ADD invoice_name VARCHAR;
UPDATE credit_request
SET invoice_name = (
SELECT move_name
FROM account_invoice
WHERE account_invoice.id = credit_request.invoice_id
);
UPDATE credit_request SET invoice_id = NULL;
EOF
)
query_postgres_container "$INVOICE_NAME_SQL" ou13 || exit 1
# Copy filestores
copy_filestore ou12 ou12 ou13 ou13 || exit 1

View File

@@ -0,0 +1,5 @@
#!/bin/bash
echo "Post migration to 14.0..."
#compose --debug run ou14 -u base --stop-after-init --no-http

View File

@@ -0,0 +1,5 @@
#!/bin/bash
echo "Post migration to 15.0..."
#compose --debug run ou15 -u base --stop-after-init --no-http

View File

@@ -1,17 +1,5 @@
#!/bin/bash
echo "POST migration to 16.0..."
echo "Post migration to 16.0..."
# Digital currency specific - to comment if not needed
INVOICE_NAME_SQL=$(cat <<'EOF'
UPDATE credit_request
SET invoice_id = (
SELECT id
FROM account_move
WHERE account_move.name = credit_request.invoice_name
);
EOF
)
query_postgres_container "$INVOICE_NAME_SQL" ou16 || exit 1
echo "END POST migration to 16.0."
#compose --debug run ou16 -u base --stop-after-init --no-http

5
17.0/post_upgrade.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
echo "Post migration to 17.0..."
#compose --debug run ou17 -u base --stop-after-init --no-http

16
17.0/pre_upgrade.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
echo "Prepare migration to 17.0..."
# Copy database
copy_database ou16 ou17 ou17 || exit 1
# Execute SQL pre-migration commands
PRE_MIGRATE_SQL=""
echo "SQL command = $PRE_MIGRATE_SQL"
query_postgres_container "$PRE_MIGRATE_SQL" ou17 || exit 1
# Copy filestores
copy_filestore ou16 ou16 ou17 ou17 || exit 1
echo "Ready for migration to 17.0!"

3
17.0/upgrade.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
compose -f ../compose.yml run -p 8017:8069 ou17 --config=/opt/odoo/auto/odoo.conf --stop-after-init -u all --workers 0 --log-level=warn --max-cron-threads=0 --limit-time-real=10000 --database=ou17 --load=web,openupgrade_framework

5
18.0/post_upgrade.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
echo "Post migration to 18.0..."
#compose --debug run ou18 -u base --stop-after-init --no-http

16
18.0/pre_upgrade.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
echo "Prepare migration to 18.0..."
# Copy database
copy_database ou17 ou18 ou18 || exit 1
# Execute SQL pre-migration commands
PRE_MIGRATE_SQL=""
echo "SQL command = $PRE_MIGRATE_SQL"
query_postgres_container "$PRE_MIGRATE_SQL" ou18 || exit 1
# Copy filestores
copy_filestore ou17 ou17 ou18 ou18 || exit 1
echo "Ready for migration to 18.0!"

3
18.0/upgrade.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
compose -f ../compose.yml run -p 8018:8069 ou18 --config=/opt/odoo/auto/odoo.conf --stop-after-init -u all --workers 0 --log-level=warn --max-cron-threads=0 --limit-time-real=10000 --database=ou18 --load=web,openupgrade_framework

View File

@@ -75,4 +75,4 @@ ou17:
postgres:
docker-compose:
image: docker.0k.io/postgres:12.15.0-myc
image: docker.0k.io/postgres:17.2.0-myc

View File

@@ -71,9 +71,9 @@ copy_filestore(){
local FROM_DB="$2"
local TO_SERVICE="$3"
local TO_DB="$4"
mkdir -p /srv/datastore/data/"$TO_SERVICE"/var/lib/odoo/filestore/"$TO_DB" || exit 1
rm -rf /srv/datastore/data/"$TO_SERVICE"/var/lib/odoo/filestore/"$TO_DB" || exit 1
cp -a /srv/datastore/data/"$FROM_SERVICE"/var/lib/odoo/filestore/"$FROM_DB" /srv/datastore/data/"$TO_SERVICE"/var/lib/odoo/filestore/"$TO_DB" || exit 1
sudo mkdir -p /srv/datastore/data/"$TO_SERVICE"/var/lib/odoo/filestore/"$TO_DB" || exit 1
sudo rm -rf /srv/datastore/data/"$TO_SERVICE"/var/lib/odoo/filestore/"$TO_DB" || exit 1
sudo cp -a /srv/datastore/data/"$FROM_SERVICE"/var/lib/odoo/filestore/"$FROM_DB" /srv/datastore/data/"$TO_SERVICE"/var/lib/odoo/filestore/"$TO_DB" || exit 1
echo "Filestore $FROM_SERVICE/$FROM_DB copied."
}
export -f copy_filestore
@@ -118,7 +118,7 @@ fi
# Remove finale database and datastore if already exists (we need a virgin Odoo)
if docker exec -u 70 "$POSTGRES_SERVICE_NAME" pgm ls | grep -q "$FINALE_SERVICE_NAME"; then
docker exec -u 70 "$POSTGRES_SERVICE_NAME" pgm rm -f "$FINALE_SERVICE_NAME"
rm -rf /srv/datastore/data/"$FINALE_SERVICE_NAME"/var/lib/odoo/filestore/"$FINALE_SERVICE_NAME"
sudo rm -rf /srv/datastore/data/"$FINALE_SERVICE_NAME"/var/lib/odoo/filestore/"$FINALE_SERVICE_NAME"
fi
compose --debug run "$FINALE_SERVICE_NAME" -i base --stop-after-init --no-http