Explicitly declare length of large MySQL indices.
Most MySQL installs silently truncate indices at a specific number of bytes. This value is 767 bytes unless either the innodb_large_prefix option is turned on or the innodb_page_size has been changed. This change explicitly limits the size of large indices to 767 characters due to the latin1 charset being 1 byte per char.
This commit is contained in:
parent
88a60d05b6
commit
baa4918d89
2 changed files with 24 additions and 2 deletions
|
@ -0,0 +1,22 @@
|
|||
"""mysql max index lengths
|
||||
|
||||
Revision ID: 228d1af6af1c
|
||||
Revises: 5b84373e5db
|
||||
Create Date: 2015-01-06 14:35:24.651424
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '228d1af6af1c'
|
||||
down_revision = '5b84373e5db'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
def upgrade(tables):
|
||||
op.drop_index('queueitem_queue_name', table_name='queueitem')
|
||||
op.create_index('queueitem_queue_name', 'queueitem', ['queue_name'], unique=False, mysql_length=767)
|
||||
|
||||
def downgrade(tables):
|
||||
pass
|
Reference in a new issue