Skip to content

Instantly share code, notes, and snippets.

View mgarces's full-sized avatar
🎧

Marco Garcês mgarces

🎧
View GitHub Profile
URL_DB_SOURCE = jdbc:mysql://10.2.24.167:3306/alfresco
USER_DB_SOURCE = alfresco
PASSWORD_DB_SOURCE = alfresco
URL_DB_DESTINATION = jdbc:postgresql://10.2.31.23:5432/ECMPRD01_alfresco1
USER_DB_DESTINATION = alfresco
PASSWORD_DB_DESTINATION = alfresco
ONLY_NOT_EMPTY = false
TRANSFER.THREADS = 8
MYSQL.NORMALIZE.BIT_BOOLEAN = true
CONSTRAIN.KEEP_NAMES = true
CREATE OR REPLACE FUNCTION "reset_sequence" (tablename text, columnname text, sequence_name text) RETURNS "pg_catalog"."void" AS
$body$
DECLARE
BEGIN
EXECUTE 'SELECT setval( ''' || sequence_name || ''', ' || '(SELECT MAX(' || columnname || ') FROM ' || tablename ')';
exception when others then
raise notice 'Wrong column name, ignore';
END;
@mgarces
mgarces / gist:9915424
Last active March 14, 2024 15:13
Steps I took to migrate my Alfresco 3.4d on MariaDB 5.5 to Alfresco 4.0d Postgres 9.3
# Marco Garcês - mgarces at sysadmin dot pt
# 2014
# These are the steps I took to migrate an Alfresco 3.4d community, running on top of MariaDB 5.5.35-1
# to Alfresco 4.0d on PostgreSQL 9.3.4 [CentOS release 6.5 (Final)]
#
# Prerequisites:
# You need the original MySQL Database (I used a cloned virtual machine of my original server), 2 empty Postgres databases, with # name alfresco and alfresco40, with owner alfresco, password alfresco.
# I have also used the soon-to-be opensource tool, DBTransfer (https://github.com/mgarces/dbtransfer) to move the data from
# MySQL to PostgreSQL.
#
Prerequisite
One instance of Alfresco on mysql, one postgresl of exactly the same version (schema version).
Step 1. Dump database
mysqldump --port 3306 -u alfresco --password=alfresco -h 127.0.0.1 --databases alfresco --skip-comments --skip-extended-insert --no-create-db --hex-blob --default-character-set=utf8 --skip-triggers --compact --no-create-info --skip-quote-names --compatible=postgresql > mydump.sql
Step 2. Dump local Postgres schema
You can install a clean version of Alfresco to use as for schema dump
(need to insert command for dump here)