FAQ Migrate my Mysql database to PostgreSQL: Difference between revisions

Line 8: Line 8:


===Export Mysql===
===Export Mysql===
* Go onto page Setup - Tools - Backup.  
* Go onto page '''Setup - Tools - Backup'''.  
* Choose export method "MySql dump".
* Choose export method "'''MySql dump'''".
* Choose export compatibility "POSTGRESQL".
* Choose export compatibility "'''POSTGRESQL'''".
* Choose "Compress None" and click on "Build backup".
* Choose "'''Compress None'''" and click on "'''Build backup'''".
* Go into directory of your Dolibarr data files (directory is defined into "'''Setup - System information - Dolibarr - All parameters'''" on line "'''Root directory for data files'''").
* Go into subdirectory '''admin/backup'''. You will find the dump of database you just build with previous step.


* Go into directory of your Dolibarr data files (directory is defined into "Setup - System information - Dolibarr - All parameters" on line "Root directory for data files").
===Create a PostGreSQL database===
* Go into subdirectory admin/backup. You will find the dump of database you just build with previous step.
* Create an empty PostGreSQL database. This step is no describe into this page. Take a look at PostgreSql for this.


===Create a PostGreSQL database===
=== Import sauvegarde ===
* Create an empty PostGreSQL database
* Modify the generated file to set escape characters with correct characters:
* Import the MySql dump file into the new PostgreSql database by this way ...
<source lang="bash">
{{ToComplete}}
sed "s/\\\'/\'\'/g" mysqldump_mydatabase_version_date.sql > mysqldump_readyforpgsql.sql
</source>
* Après avoir convertit le fichier, importer le sur votre base postgresql vierge:
<source lang="bash">
psql -h name_or_ip_of_postgresql_server -d name_database_postgresql -U login_database_mysql -f mysqldump_readyforpgsql.sql
</source>


===Modify you Dolibarr setup file===
===Modify you Dolibarr setup file===
Line 35: Line 42:
===Test===
===Test===
You should now have an application 100% working with all its data.
You should now have an application 100% working with all its data.
Old MySql database can be closed.