sql: add buildset uuid column
This change adds a uuid column to the buildset table to record the buildset uuid. Change-Id: Ie79ce738caa028035d5b625b57296133311986dd
This commit is contained in:
parent
5fbc185236
commit
7635bf52d6
|
@ -74,7 +74,7 @@ class TestSQLConnection(ZuulDBTestCase):
|
|||
buildset_table = table_prefix + 'zuul_buildset'
|
||||
build_table = table_prefix + 'zuul_build'
|
||||
|
||||
self.assertEqual(14, len(insp.get_columns(buildset_table)))
|
||||
self.assertEqual(15, len(insp.get_columns(buildset_table)))
|
||||
self.assertEqual(10, len(insp.get_columns(build_table)))
|
||||
|
||||
def test_sql_tables_created(self):
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Add uuid to buldset
|
||||
|
||||
Revision ID: 649ce63b5fe5
|
||||
Revises: ea2bae776723
|
||||
Create Date: 2019-01-11 06:17:40.042738
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '649ce63b5fe5'
|
||||
down_revision = 'ea2bae776723'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade(table_prefix=''):
|
||||
op.add_column(
|
||||
table_prefix + 'zuul_buildset', sa.Column('uuid', sa.String(36)))
|
||||
|
||||
|
||||
def downgrade():
|
||||
raise Exception("Downgrades not supported")
|
|
@ -176,6 +176,7 @@ class SQLConnection(BaseConnection):
|
|||
class BuildSetModel(Base):
|
||||
__tablename__ = self.table_prefix + BUILDSET_TABLE
|
||||
id = sa.Column(sa.Integer, primary_key=True)
|
||||
uuid = sa.Column(sa.String(36))
|
||||
zuul_ref = sa.Column(sa.String(255))
|
||||
pipeline = sa.Column(sa.String(255))
|
||||
project = sa.Column(sa.String(255))
|
||||
|
|
|
@ -56,6 +56,7 @@ class SQLReporter(BaseReporter):
|
|||
|
||||
with self.connection.getSession() as db:
|
||||
db_buildset = db.createBuildSet(
|
||||
uuid=item.current_build_set.uuid,
|
||||
tenant=item.pipeline.tenant.name,
|
||||
pipeline=item.pipeline.name,
|
||||
project=item.change.project.name,
|
||||
|
|
Loading…
Reference in New Issue