To use lv_LV.UTF-8 locale your unix system should have it, check it:
$ locale -a
If it's not here, then on linux as root
uncomment it in /etc/locale.gen
and
run locale-gen
. Then restart PostgreSQL server.
Open postgres shell:
$ su postgres
$ psql
Check available collations:
postgres=# select * from pg_collation;
If LV not found then create it:
postgres=# create collation lv_LV (locale = 'lv_LV.utf8');
On rails 4 you can add these to database.yml
and just create the DB:
encoding: utf8
ctype: lv_LV.utf8
collation: lv_LV.utf8
template: template0
but on rails 3 you have 2 options:
-
Re-init your database
initdb --locale=lv_LV.UTF-8 --lc-ctype=lv_LV.UTF-8 --lc-collate=lv_LV.UTF-8
and now all databases by default will uselv_LV.UTF-8
-
Drop current database and create it with
template0
and specifycollation
:create database myapp_development template template0 encoding 'utf8' lc_collate 'lv_LV.utf8' lc_ctype 'lv_LV.utf8'; create database myapp_test template template0 encoding 'utf8' lc_collate 'lv_LV.utf8' lc_ctype 'lv_LV.utf8';