]> git.openstreetmap.org Git - rails.git/blobdiff - db/migrate/20121203124841_change_note_address_to_inet.rb
Convert author_ip to a proper INET field
[rails.git] / db / migrate / 20121203124841_change_note_address_to_inet.rb
diff --git a/db/migrate/20121203124841_change_note_address_to_inet.rb b/db/migrate/20121203124841_change_note_address_to_inet.rb
new file mode 100644 (file)
index 0000000..e4e53e3
--- /dev/null
@@ -0,0 +1,9 @@
+class ChangeNoteAddressToInet < ActiveRecord::Migration
+  def up
+    execute "ALTER TABLE note_comments ALTER COLUMN author_ip TYPE inet USING CAST(author_ip AS inet)"
+  end
+
+  def down
+    change_column :note_comments, :author_ip, :string
+  end
+end