LoginSignup
0
0

More than 5 years have passed since last update.

activerecord-postgis-adapterでカラムをGeography型に変換

Posted at

activerecord-postgis-adapterをRails4.2に対応している3系にアップデートしたらtypeをしていてgeography型のつもりがgeometry型になっているカラムがあった。

これが原因でエラーが発生したためマイグレーションを書いた。

この時のchange_columnする際の型指定の方法の例。

change_column :post_photos, :geog, 'geography(Point,4326)', null: false

良い方法がわからなかったので文字列で指定した。
うまく動いている。null: false はオプションをつける例としてつけた。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0