mrAceT / nextcloud-S3-local-S3-migration

Script for migrating Nextcloud primary storage from S3 to local to S3 storage
GNU General Public License v3.0
67 stars 11 forks source link

A version of localtos3.php adapted for PostgreSQL made with the help of ChatGPT #16

Open DavidCamejo opened 2 months ago

DavidCamejo commented 2 months ago

This is a raw version that has not been reviewed or corrected. The idea is that together we can create a fully functional final version. I'm new to Github. This is the easiest way to share the file: https://cloud.brasdrive.com.br/s/f3cReWoRGAxaDMH

Explanation of the Adaptations Made Connection to PostgreSQL:

All database connections and queries were changed from MySQL to PostgreSQL using pg_connect, pg_query, and related functions. Backup and Restore Commands:

The backup and restore commands were changed to use pg_dump and psql instead of mysqldump and mysql. SQL Queries:

The SQL queries were adapted to use PostgreSQL syntax, including double quotes for identifiers and specific functions like EXTRACT(EPOCH FROM ...). Execution Options:

The dry-run, update-db, and delete-local options were kept as they were in the original script. S3 Compatibility:

The configuration and use of AWS S3 for file synchronization were maintained. This script should be executed in the Docker environment of Nextcloud to ensure that all dependencies and specific configurations are available. Be sure to make a full backup before running it in your production environment.

szelga commented 2 weeks ago

I've made a version utilizing PDO, so theoretically it could be adapted to a "universal" script. still needs some work on SQL scripts to see, if there are some flavor-independent options (mostly considering time functions in MySQL and PostgreSQL).

szelga commented 2 weeks ago

here it is:

localtos3_pg.php.txt

tested on a real (albeit small) NextCloud docker installation.

szelga commented 2 weeks ago

had issues with OnlyOffice previews after that, had to turn them off. not sure if this is due to migration or wonky OnlyOffice integration settings.

mrAceT commented 2 weeks ago

When I find the time I'll take a look at your work, thanks for sharing