From 31a031be26408b7cb2487203a2bfd8aa5eb51a3e Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 3 Dec 2012 13:00:52 +0000 Subject: [PATCH] Convert author_ip to a proper INET field --- db/migrate/20121203124841_change_note_address_to_inet.rb | 9 +++++++++ db/structure.sql | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 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 index 000000000..e4e53e35a --- /dev/null +++ b/db/migrate/20121203124841_change_note_address_to_inet.rb @@ -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 diff --git a/db/structure.sql b/db/structure.sql index eaf279f9c..b76995b68 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -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, - author_ip character varying(255), + author_ip inet, 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 ('20121203124841'); + INSERT INTO schema_migrations (version) VALUES ('21'); INSERT INTO schema_migrations (version) VALUES ('22'); -- 2.43.2