Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
      
  
  
  This guide covers PostgreSQL specific usage of Active Record. After reading this guide, you will know: How to use PostgreSQL's datatypes. How to use UUID primary keys. How to include non-key columns in indexes. How to use deferrable foreign keys. How to use unique constraints. How to implement exclusion constraints. How to implement full text search with PostgreSQL. How to back your Active Record
はじめに 自分用のメモです。 Railsでカラムのデータ型を変更する場合の手順を載せておきます。 関連するインデックスやHeroku Schedulerなどは人によっては使っていないと思いますが、そのあたりは臨機応変に読み替えてください。 実行環境 Rails 3.2 ローカル環境: Sqlite ステージング環境: Heroku Cedar + PostgreSQL 手順 概要 先に手順の概要をリストアップするとこんな感じです。 以前のエントリでも書きましたが、change_columnでいきなり既存のカラムのデータ型を変更しようとするとPostgreSQLでエラーが発生するので、ちょっと面倒な手順(新しいカラムを追加して既存のカラムとスワップ)になります。 設計する Gitでブランチを作る 新しいカラムの追加 DB上で関連するインデックスを削除する DB上で古いカラムをリネームする D
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く