A platform for community discussion. Free, open, simple.
FIX: DROP NOT NULL instead of changing all the rows in the table.
Guo Xiang Tana6e9f4f44b67
diff --git a/db/migrate/20180521175611_change_indexes_topic_view_item.rb b/db/migrate/20180521175611_change_indexes_topic_view_item.rbindex 97f5afe8432..21300d91f22 100644--- a/db/migrate/20180521175611_change_indexes_topic_view_item.rb+++ b/db/migrate/20180521175611_change_indexes_topic_view_item.rb@@ -1,12 +1,5 @@class ChangeIndexesTopicViewItem < ActiveRecord::Migration[5.1]def up- begin- Migration::SafeMigrate.disable!- change_column :topic_views, :ip_address, :inet, null: true- ensure- Migration::SafeMigrate.enable!- end-remove_index :topic_views,column: [:ip_address, :topic_id],name: :ip_address_topic_id_topic_views,diff --git a/db/migrate/20180717025038_drop_not_null_ip_address_on_topic_views.rb b/db/migrate/20180717025038_drop_not_null_ip_address_on_topic_views.rbnew file mode 100644index 00000000000..34288629612--- /dev/null+++ b/db/migrate/20180717025038_drop_not_null_ip_address_on_topic_views.rb@@ -0,0 +1,10 @@+class DropNotNullIpAddressOnTopicViews < ActiveRecord::Migration[5.2]+ def change+ begin+ Migration::SafeMigrate.disable!+ change_column_null :topic_views, :ip_address, true+ ensure+ Migration::SafeMigrate.enable!+ end+ end+end