Skip to content

Commit

Permalink
Merge pull request #1817 from selenamarie/bug963233-add-version_build…
Browse files Browse the repository at this point in the history
…-column

Fixes bug 963233 - add version_build to tables
  • Loading branch information
selenamarie committed Jan 24, 2014
2 parents bf29250 + 3f745d0 commit 7f72707
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
30 changes: 30 additions & 0 deletions alembic/versions/4bb277899d74_add_version_build_co.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""Add version_build column
Revision ID: 4bb277899d74
Revises: 355d0795af7f
Create Date: 2014-01-23 15:37:08.692426
"""

# revision identifiers, used by Alembic.
revision = '4bb277899d74'
down_revision = '355d0795af7f'

from alembic import op
from socorro.lib import citexttype, jsontype, buildtype
from socorro.lib.migrations import fix_permissions, load_stored_proc

import sqlalchemy as sa
from sqlalchemy import types
from sqlalchemy.dialects import postgresql
from sqlalchemy.sql import table, column


def upgrade():
op.add_column(u'product_versions', sa.Column(u'version_build', sa.TEXT(), nullable=True))
op.add_column(u'releases_raw', sa.Column(u'version_build', sa.TEXT(), nullable=True))


def downgrade():
op.drop_column(u'releases_raw', u'version_build')
op.drop_column(u'product_versions', u'version_build')
6 changes: 4 additions & 2 deletions socorro/external/postgresql/fakedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,8 @@ class ReleaseChannelMatches(BaseTable):
class ReleasesRaw(BaseTable):
table = 'releases_raw'
columns = ['product_name', 'version', 'platform', 'build_id',
'update_channel', 'beta_number', 'repository', 'build_type']
'update_channel', 'beta_number', 'repository',
'build_type', 'version_build']

def generate_rows(self):
for product in self.releases:
Expand Down Expand Up @@ -488,7 +489,8 @@ def generate_rows(self):
row = [product.lower(), number, os_name,
buildid, update_channel.lower(),
beta_number, repository,
update_channel.lower()]
update_channel.lower(),
beta_number]
yield row


Expand Down
2 changes: 2 additions & 0 deletions socorro/external/postgresql/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,7 @@ class ProductVersion(DeclarativeBase):
# is fully deprecated, also make this part of the primary key later. It
# will look like this:
# build_type = Column(u'build_type_enum', build_type_enum(), nullable=False, server_default='release')
version_build = Column(u'version_build', TEXT()) # Replaces 'beta_number'

__table_args__ = (
Index('product_version_version_key', product_name, version_string, unique=True),
Expand Down Expand Up @@ -1033,6 +1034,7 @@ class ReleasesRaw(DeclarativeBase):
# Above is a transition definition.
# Ultimately we will define build_type as follows:
# update_channel = Column(u'update_channel', TEXT(), primary_key=True, nullable=False)
version_build = Column(u'version_build', TEXT())

#relationship definitions

Expand Down

0 comments on commit 7f72707

Please sign in to comment.