diff --git a/db/migrate/20120101000001_create_base.rb b/db/migrate/20120101000001_create_base.rb index 0c3f16752..ea1212388 100644 --- a/db/migrate/20120101000001_create_base.rb +++ b/db/migrate/20120101000001_create_base.rb @@ -36,7 +36,7 @@ class CreateBase < ActiveRecord::Migration[4.2] t.boolean :vip, default: false t.boolean :verified, null: false, default: false t.boolean :active, null: false, default: true - t.string :note, limit: 250, null: true, default: '' + t.string :note, limit: 5000, null: true, default: '' t.timestamp :last_login, limit: 3, null: true t.string :source, limit: 200, null: true t.integer :login_failed, null: false, default: 0 @@ -147,7 +147,7 @@ class CreateBase < ActiveRecord::Migration[4.2] t.string :domain, limit: 250, null: true, default: '' t.boolean :domain_assignment, null: false, default: false t.boolean :active, null: false, default: true - t.string :note, limit: 250, null: true, default: '' + t.string :note, limit: 5000, null: true, default: '' t.integer :updated_by_id, null: false t.integer :created_by_id, null: false t.timestamps limit: 3, null: false diff --git a/db/migrate/20171002091043_change_note_char_limit_for_users_and_organizations.rb b/db/migrate/20171002091043_change_note_char_limit_for_users_and_organizations.rb new file mode 100644 index 000000000..91d64f89b --- /dev/null +++ b/db/migrate/20171002091043_change_note_char_limit_for_users_and_organizations.rb @@ -0,0 +1,20 @@ +class ChangeNoteCharLimitForUsersAndOrganizations < ActiveRecord::Migration[5.1] + def up + # return if it's a new setup to avoid running the migration + return if !Setting.find_by(name: 'system_init_done') + + change_column :organizations, :note, :string, limit: 5000 + change_column :users, :note, :string, limit: 5000 + + object_id = ObjectLookup.by_name('User') + attribute = ObjectManager::Attribute.find_by(object_lookup_id: object_id, name: 'note') + attribute.data_option[:maxlength] = 5000 + attribute.save! + + object_id = ObjectLookup.by_name('Organization') + attribute = ObjectManager::Attribute.find_by(object_lookup_id: object_id, name: 'note') + attribute.data_option[:maxlength] = 5000 + attribute.save! + end + +end diff --git a/db/seeds/object_manager_attributes.rb b/db/seeds/object_manager_attributes.rb index e622a82e8..41ab17826 100644 --- a/db/seeds/object_manager_attributes.rb +++ b/db/seeds/object_manager_attributes.rb @@ -1077,7 +1077,7 @@ ObjectManager::Attribute.add( data_type: 'richtext', data_option: { type: 'text', - maxlength: 250, + maxlength: 5000, null: true, note: 'Notes are visible to agents only, never to customers.', }, @@ -1329,7 +1329,7 @@ ObjectManager::Attribute.add( data_type: 'richtext', data_option: { type: 'text', - maxlength: 250, + maxlength: 5000, null: true, note: 'Notes are visible to agents only, never to customers.', },