Refstack should work with MySQL in utf-8 charset
Test name requires length of 512 chars, so its collation explicitly is set to 'latin-1'. All other string fields can be stored as utf-8 strings. Change-Id: Ieba8b4aa28bd63cbdf66a9b0d2d267f64ccb9764
This commit is contained in:
parent
1f04771ff4
commit
11169dffe6
|
@ -9,6 +9,7 @@ Create Date: 2015-01-09 15:00:11.385580
|
|||
# revision identifiers, used by Alembic.
|
||||
revision = '42278d6179b9'
|
||||
down_revision = None
|
||||
MYSQL_CHARSET = 'utf8'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
@ -24,7 +25,8 @@ def upgrade():
|
|||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('cpid', sa.String(length=128), nullable=False),
|
||||
sa.Column('duration_seconds', sa.Integer(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_charset=MYSQL_CHARSET,
|
||||
)
|
||||
op.create_table(
|
||||
'meta',
|
||||
|
@ -38,7 +40,8 @@ def upgrade():
|
|||
sa.Column('value', sa.Text(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['test_id'], ['test.id'], ),
|
||||
sa.PrimaryKeyConstraint('_id'),
|
||||
sa.UniqueConstraint('test_id', 'meta_key')
|
||||
sa.UniqueConstraint('test_id', 'meta_key'),
|
||||
mysql_charset=MYSQL_CHARSET
|
||||
)
|
||||
op.create_table(
|
||||
'results',
|
||||
|
@ -48,7 +51,9 @@ def upgrade():
|
|||
sa.Column('_id', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('test_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('name', sa.String(length=512), nullable=True),
|
||||
sa.Column('name',
|
||||
sa.String(length=512, collation='latin1_swedish_ci'),
|
||||
nullable=True),
|
||||
sa.Column('uuid', sa.String(length=36), nullable=True),
|
||||
sa.ForeignKeyConstraint(['test_id'], ['test.id'], ),
|
||||
sa.PrimaryKeyConstraint('_id'),
|
||||
|
@ -57,6 +62,7 @@ def upgrade():
|
|||
# Constraint should turned on after duplication test uuids issue
|
||||
# will be fixed
|
||||
# sa.UniqueConstraint('test_id', 'uuid')
|
||||
mysql_charset=MYSQL_CHARSET
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ class TestResults(BASE, RefStackBase):
|
|||
_id = sa.Column(sa.Integer, primary_key=True, autoincrement=True)
|
||||
test_id = sa.Column(sa.String(36), sa.ForeignKey('test.id'),
|
||||
index=True, nullable=False, unique=False)
|
||||
name = sa.Column(sa.String(512))
|
||||
name = sa.Column(sa.String(512, collation='latin1_swedish_ci'),)
|
||||
uuid = sa.Column(sa.String(36))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue