Migrasi database Postgres ke UNICODE

Ass. Wr Wb.
Coba migrasi database moodle di postgresql dengan encoding unicode supaya mendukung paket bahasa
Langkah2nya adalah sebagai berikut,

1.Bikin database baru yang support encoding unicode
# createdb -U {user} {db} -E UNICODE

2. Ikuti langkah berikut,

a. database yang di dump dulu
PGCLIENTENCODING='UNICODE' PGDATABASE=[dbname] pg_dump -Fp -O -x -U [dbuser] > dump1
b Move out "COMMENT ON SCHEMA" statement which will cause error while importing with a non-root user.
Run command:
grep -v "COMMENT ON SCHEMA" < dump1 > dump2
c. Strip out any non-unicode characters with iconv
Run command:
iconv -f UTF-8 -t UTF-8 -c < dump2 > dump3
d. Import the data to your new unicode database
Run command:

PGDATABASE=[dbname] psql -q -U [dbuser] -v ON_ERROR_STOP=1 < dump3

3. Edit config.php dari moodle
5. Selesai

Wassalam

Komentar

Postingan populer dari blog ini

Membuat Web Directory dengan Drupal

Membandingkan Kecepatan Web PT di Yogyakarta

Migrasi data bocor dari CSV ke PostgreSQL