<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>rnakamine</author_name>
  <author_url>https://blog.hatena.ne.jp/rnakamine/</author_url>
  <blog_title>Ryo Nakamine</blog_title>
  <blog_url>https://rnakamine.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
    <anon>Ruby on Rails</anon>
  </categories>
  <description>すでにindexが貼られているカラムに対して、以下のようにmigrationファイルを編集してunique制限をかけようとした時に def change add_index :users, :email, unique: true end そのままdb:migrateすると Index name 'index_users_on_email' on table 'users' already exists と怒られてしまうので、その対策メモ 対応 そのままindexを追加すると既に存在するということでエラーがでてしまうので、 一旦、indexを削除してからunique制限をかけると、上手くいった…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Frnakamine.hatenablog.com%2Fentry%2F2018%2F08%2F21%2F022540&quot; title=&quot;すでにindex貼られているカラムに対してunique制限をかける方法 - Ruby on Rails - Ryo Nakamine&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2018-08-21 02:25:40</published>
  <title>すでにindex貼られているカラムに対してunique制限をかける方法 - Ruby on Rails</title>
  <type>rich</type>
  <url>https://rnakamine.hatenablog.com/entry/2018/08/21/022540</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
