summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Henkel <tobias.henkel@bmw.de>2018-01-09 17:21:30 +0100
committerTobias Henkel <tobias.henkel@bmw.de>2018-01-09 17:32:16 +0100
commit3426779dedb4fdc6afcc0091b9ca2b95b8599ed6 (patch)
tree2ae919fb6027d6d3b1d940e882609b93789d045d
parentca2da75ca5748b1b2b0e6a0b400e0a1e443d917b (diff)
downloadzuul-3426779dedb4fdc6afcc0091b9ca2b95b8599ed6.tar.gz
Change patchset column to string
When running zuul with Github the sql reporter fails when trying to report data [1]. The reason for this is that github uses the git sha of the PR head as patchset which is no integer. Thus we must change this column to string. [1] Error message: sqlalchemy.exc.DataError: (psycopg2.DataError) invalid input syntax for integer: "fa42019a0d4f2a4a99ed6704c3fd037b7812e08f" LINE 1: ...b56049945e792082', 'check', 'foo/bar', 2, 'fa42019a0... Change-Id: I26ff56159c2710af1515955d27bf4e9ebfcf76e9
-rw-r--r--zuul/driver/sql/alembic/versions/cfc0dc45f341_change_patchset_to_string.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/zuul/driver/sql/alembic/versions/cfc0dc45f341_change_patchset_to_string.py b/zuul/driver/sql/alembic/versions/cfc0dc45f341_change_patchset_to_string.py
new file mode 100644
index 000000000..3fde8e545
--- /dev/null
+++ b/zuul/driver/sql/alembic/versions/cfc0dc45f341_change_patchset_to_string.py
@@ -0,0 +1,30 @@
+"""Change patchset to string
+
+Revision ID: cfc0dc45f341
+Revises: ba4cdce9b18c
+Create Date: 2018-01-09 16:44:31.506958
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'cfc0dc45f341'
+down_revision = 'ba4cdce9b18c'
+branch_labels = None
+depends_on = None
+
+from alembic import op
+import sqlalchemy as sa
+
+BUILDSET_TABLE = 'zuul_buildset'
+
+
+def upgrade(table_prefix=''):
+ op.alter_column(table_prefix + BUILDSET_TABLE,
+ 'patchset',
+ sa.String(255),
+ existing_nullable=True,
+ existing_type=sa.Integer)
+
+
+def downgrade():
+ raise Exception("Downgrades not supported")