Last active
January 20, 2021 11:12
-
-
Save upinetree/9f643d02bdb8d245b66c to your computer and use it in GitHub Desktop.
Revisions
-
Takuya Matsumoto revised this gist
Jul 2, 2015 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,6 +22,14 @@ ja_JP.UTF-8 > 目的のlocaleを確認 $ be bin/rails db =# SHOW LC_COLLATE; lc_collate ------------- ja_JP.UTF-8 (1 row) > データベースのcollationにも入っているのに… =# \l > templateのCollateにja_JP.UTF-8が設定されているのに… -
Takuya Matsumoto revised this gist
Jul 2, 2015 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,6 +25,9 @@ $ be bin/rails db =# \l > templateのCollateにja_JP.UTF-8が設定されているのに… =# ALTER TABLE users ALTER COLUMN kana TYPE varchar COLLATE "ja_JP.utf8"; ERROR: collation "ja_JP.utf8" for encoding "UTF8" does not exist =# SELECT * from pg_collation; > ja_JP.UTF-8に対応するcollationがない… -
Takuya Matsumoto revised this gist
Jul 2, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ ## 特定のテーブルのカラムにだけCOLLATIONを設定する方法 ``` $ be bin/rails db =# ALTER TABLE users ALTER COLUMN kana TYPE varchar COLLATE "ja_JP.utf8"; > 特定のカラムにだけ付与 -
Takuya Matsumoto revised this gist
Jul 2, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ ## 特定のテーブルのカラムにだけCOLLATIONを設定する方法 ```bash $ be bin/rails db =# ALTER TABLE users ALTER COLUMN kana TYPE varchar COLLATE "ja_JP.utf8"; > 特定のカラムにだけ付与 -
Takuya Matsumoto renamed this gist
Jul 2, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Takuya Matsumoto revised this gist
Jul 2, 2015 . No changes.There are no files selected for viewing
-
Takuya Matsumoto created this gist
Jul 2, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ ## 特定のテーブルのカラムにだけCOLLATIONを設定する方法 ``` $ be bin/rails db =# ALTER TABLE users ALTER COLUMN kana TYPE varchar COLLATE "ja_JP.utf8"; > 特定のカラムにだけ付与 =# \d staffs > 付与したことを確認 ``` ## お目当てのCOLLATIONが存在しないときに作る方法 macにbrewで入れたpostgresqlに`ja_JP.UTF-8`がなかったので作りました。 ``` $ locale -a | grep ja ja_JP ja_JP.eucJP ja_JP.SJIS ja_JP.UTF-8 > 目的のlocaleを確認 $ be bin/rails db =# \l > templateのCollateにja_JP.UTF-8が設定されているのに… =# SELECT * from pg_collation; > ja_JP.UTF-8に対応するcollationがない… =# CREATE COLLATION "ja_JP.utf8" (LOCALE = 'ja_JP.UTF-8'); > つくられた ```