Merge "Rename test uid field to "uuid""

This commit is contained in:
Jenkins 2015-04-06 18:54:08 +00:00 committed by Gerrit Code Review
commit 9c729f2ed5
4 changed files with 12 additions and 10 deletions

View File

@ -72,7 +72,7 @@ class TestResultValidator(Validator):
'type': 'object',
'properties': {
'name': {'type': 'string'},
'uid': {
'uuid': {
'type': 'string',
'format': 'uuid_hex'
}

View File

@ -15,7 +15,6 @@ import sqlalchemy as sa
def upgrade():
# commands auto generated by Alembic - please adjust!
op.create_table(
'test',
sa.Column('updated_at', sa.DateTime()),
@ -50,18 +49,18 @@ def upgrade():
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('uid', sa.String(length=36), nullable=True),
sa.Column('uuid', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['test_id'], ['test.id'], ),
sa.PrimaryKeyConstraint('_id'),
sa.UniqueConstraint('test_id', 'name'),
sa.UniqueConstraint('test_id', 'uid')
# TODO(sslypushenko)
# Constraint should turned on after duplication test uuids issue
# will be fixed
# sa.UniqueConstraint('test_id', 'uuid')
)
# end Alembic commands
def downgrade():
# commands auto generated by Alembic - please adjust!
op.drop_table('results')
op.drop_table('meta')
op.drop_table('test')
# end Alembic commands

View File

@ -74,7 +74,7 @@ def store_results(results):
test_result = models.TestResults()
test_result.test_id = test_id
test_result.name = result['name']
test_result.uid = result.get('uid', None)
test_result.uuid = result.get('uuid', None)
test_result.save(session)
return test_id

View File

@ -57,13 +57,16 @@ class TestResults(BASE, RefStackBase):
__tablename__ = 'results'
__table_args__ = (
sa.UniqueConstraint('test_id', 'name'),
sa.UniqueConstraint('test_id', 'uid'),
# TODO(sslypushenko)
# Constraint should turned on after duplication test uuids issue
# will be fixed
# sa.UniqueConstraint('test_id', 'uuid'),
)
_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))
uid = sa.Column(sa.String(36))
uuid = sa.Column(sa.String(36))
class TestMeta(BASE, RefStackBase):