Add warning about MySQL collation Fix database index length This allows new databases to be created with utf8mb4, on MySQL. The maximum column size is 767 bytes. Each character is 4 bytes long -> 767 / 4 = 191 characters for the column.
17 lines
583 B
Ruby
17 lines
583 B
Ruby
class CreateChatContacts < ActiveRecord::Migration
|
|
def up
|
|
create_table :chat_contacts do |t|
|
|
t.integer :user_id, null: false
|
|
## JID <= 3071 bytes http://tools.ietf.org/html/rfc6122
|
|
t.string :jid, limit: 3071, null: false
|
|
t.string :name, limit: 255, null: true
|
|
t.string :ask, limit: 128, null: true
|
|
t.string :subscription, limit: 128, null: false
|
|
end
|
|
add_index :chat_contacts, [:user_id, :jid], unique: true, length: {"jid": 100}
|
|
end
|
|
|
|
def down
|
|
drop_table :chat_contacts
|
|
end
|
|
end
|