]> git.openstreetmap.org Git - rails.git/commitdiff
Convert author_ip to a proper INET field
authorTom Hughes <tom@compton.nu>
Mon, 3 Dec 2012 13:00:52 +0000 (13:00 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 3 Dec 2012 14:50:55 +0000 (14:50 +0000)
db/migrate/20121203124841_change_note_address_to_inet.rb [new file with mode: 0644]
db/structure.sql

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
index eaf279f9c933cb72087bd688aee5a632e01e6dcd..b76995b6879c511532a9c5aa1a1e091b3a6f5475 100644 (file)
@@ -733,7 +733,7 @@ CREATE TABLE note_comments (
     note_id bigint NOT NULL,
     visible boolean NOT NULL,
     created_at timestamp without time zone NOT NULL,
     note_id bigint NOT NULL,
     visible boolean NOT NULL,
     created_at timestamp without time zone NOT NULL,
-    author_ip character varying(255),
+    author_ip inet,
     author_id bigint,
     body text,
     event note_event_enum
     author_id bigint,
     body text,
     event note_event_enum
@@ -2449,6 +2449,8 @@ INSERT INTO schema_migrations (version) VALUES ('20121119165817');
 
 INSERT INTO schema_migrations (version) VALUES ('20121202155309');
 
 
 INSERT INTO schema_migrations (version) VALUES ('20121202155309');
 
+INSERT INTO schema_migrations (version) VALUES ('20121203124841');
+
 INSERT INTO schema_migrations (version) VALUES ('21');
 
 INSERT INTO schema_migrations (version) VALUES ('22');
 INSERT INTO schema_migrations (version) VALUES ('21');
 
 INSERT INTO schema_migrations (version) VALUES ('22');