Remove the used_legacy_github column
This commit is contained in:
parent
5f49c4da7c
commit
c3c13de63b
3 changed files with 53 additions and 4 deletions
|
@ -472,9 +472,6 @@ class RepositoryBuildTrigger(BaseModel):
|
||||||
pull_robot = QuayUserField(allows_robots=True, null=True, related_name='triggerpullrobot',
|
pull_robot = QuayUserField(allows_robots=True, null=True, related_name='triggerpullrobot',
|
||||||
robot_null_delete=True)
|
robot_null_delete=True)
|
||||||
|
|
||||||
# TODO(jschorr): Remove this column once we verify the backfill has succeeded.
|
|
||||||
used_legacy_github = BooleanField(null=True, default=False)
|
|
||||||
|
|
||||||
|
|
||||||
class EmailConfirmation(BaseModel):
|
class EmailConfirmation(BaseModel):
|
||||||
code = CharField(default=random_string_generator(), unique=True, index=True)
|
code = CharField(default=random_string_generator(), unique=True, index=True)
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
"""Remove legacy github column
|
||||||
|
|
||||||
|
Revision ID: 73669db7e12
|
||||||
|
Revises: 35f538da62
|
||||||
|
Create Date: 2015-11-04 16:18:18.107314
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '73669db7e12'
|
||||||
|
down_revision = '35f538da62'
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
def upgrade(tables):
|
||||||
|
### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_column('repositorybuildtrigger', 'used_legacy_github')
|
||||||
|
### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade(tables):
|
||||||
|
### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.add_column('repositorybuildtrigger', sa.Column('used_legacy_github', sa.Boolean(), nullable=True))
|
||||||
|
### end Alembic commands ###
|
|
@ -2,7 +2,8 @@ import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from data.database import RepositoryBuildTrigger, BuildTriggerService, db, db_for_update
|
from data.database import (db, db_for_update, BaseModel, CharField, ForeignKeyField,
|
||||||
|
TextField, BooleanField)
|
||||||
from app import app
|
from app import app
|
||||||
from buildtrigger.basehandler import BuildTriggerHandler
|
from buildtrigger.basehandler import BuildTriggerHandler
|
||||||
from util.security.ssh import generate_ssh_keypair
|
from util.security.ssh import generate_ssh_keypair
|
||||||
|
@ -10,6 +11,32 @@ from github import GithubException
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
class BuildTriggerService(BaseModel):
|
||||||
|
name = CharField(index=True, unique=True)
|
||||||
|
|
||||||
|
class Repository(BaseModel):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class User(BaseModel):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class AccessToken(BaseModel):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class RepositoryBuildTrigger(BaseModel):
|
||||||
|
uuid = CharField()
|
||||||
|
service = ForeignKeyField(BuildTriggerService, index=True)
|
||||||
|
repository = ForeignKeyField(Repository, index=True)
|
||||||
|
connected_user = ForeignKeyField(User)
|
||||||
|
auth_token = CharField(null=True)
|
||||||
|
private_key = TextField(null=True)
|
||||||
|
config = TextField(default='{}')
|
||||||
|
write_token = ForeignKeyField(AccessToken, null=True)
|
||||||
|
pull_robot = ForeignKeyField(User, null=True, related_name='triggerpullrobot')
|
||||||
|
|
||||||
|
used_legacy_github = BooleanField(null=True, default=False)
|
||||||
|
|
||||||
|
|
||||||
def backfill_github_deploykeys():
|
def backfill_github_deploykeys():
|
||||||
""" Generates and saves private deploy keys for any GitHub build triggers still relying on
|
""" Generates and saves private deploy keys for any GitHub build triggers still relying on
|
||||||
the old buildpack behavior. """
|
the old buildpack behavior. """
|
||||||
|
|
Reference in a new issue