def upgrade(): op.create_table( 'itemstat', sa.Column('id', sa.GUID(), nullable=False), sa.Column('item_id', sa.GUID(), nullable=False), sa.Column('name', sa.String(length=64), nullable=False), sa.Column('value', sa.Integer(), nullable=False), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('item_id', 'name', name='unq_itemstat_name'))
def upgrade(): op.create_table('adminmessage', sa.Column('id', sa.GUID(), nullable=False), sa.Column('user_id', sa.GUID(), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.Column('message', sa.Text(), nullable=True), sa.ForeignKeyConstraint( ['user_id'], ['user.id'], ), sa.PrimaryKeyConstraint('id'))
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table( 'itemoption', sa.Column('id', sa.GUID(), nullable=False), sa.Column('item_id', sa.GUID(), nullable=False), sa.Column('name', sa.String(length=64), nullable=False), sa.Column('value', sa.Text(), nullable=False), sa.Column('date_created', sa.DateTime(), nullable=False), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('item_id', 'name', name='unq_itemoption_name'))
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table( 'event', sa.Column('id', sa.GUID(), nullable=False), sa.Column('type', sa.String(length=32), nullable=False), sa.Column('item_id', sa.GUID(), nullable=False), sa.Column('date_created', sa.DateTime(), nullable=True), sa.Column('date_modified', sa.DateTime(), nullable=True), sa.Column('data', sa.JSONEncodedDict(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('type', 'item_id', name='unq_event_key'))
def upgrade(): op.create_table('project_plan', sa.Column('project_id', sa.GUID(), nullable=False), sa.Column('plan_id', sa.GUID(), nullable=False), sa.ForeignKeyConstraint( ['plan_id'], ['plan.id'], ), sa.ForeignKeyConstraint( ['project_id'], ['project.id'], ), sa.PrimaryKeyConstraint('project_id', 'plan_id'))
def upgrade(): op.create_table( 'latest_green_build', sa.Column('id', sa.GUID(), nullable=False), sa.Column('project_id', sa.GUID(), nullable=False), sa.Column('branch', sa.String(length=128), nullable=False), sa.Column('build_id', sa.GUID(), nullable=False), sa.PrimaryKeyConstraint('id'), sa.ForeignKeyConstraint(['project_id'], ['project.id'], ), sa.ForeignKeyConstraint(['build_id'], ['build.id'], ), sa.UniqueConstraint('project_id', 'branch', name='unq_project_branch') )
def upgrade(): op.create_table( 'buildphase', sa.Column('id', sa.GUID(), nullable=False), sa.Column('build_id', sa.GUID(), nullable=False), sa.Column('repository_id', sa.GUID(), nullable=False), sa.Column('project_id', sa.GUID(), nullable=False), sa.Column('label', sa.String(length=128), nullable=False), sa.Column('status', sa.Enum(), nullable=False), sa.Column('result', sa.Enum(), nullable=False), sa.Column('date_started', sa.DateTime(), nullable=True), sa.Column('date_finished', sa.DateTime(), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint( ['build_id'], ['build.id'], ), sa.ForeignKeyConstraint( ['project_id'], ['project.id'], ), sa.ForeignKeyConstraint( ['repository_id'], ['repository.id'], ), sa.PrimaryKeyConstraint('id')) op.create_table( 'buildstep', sa.Column('id', sa.GUID(), nullable=False), sa.Column('build_id', sa.GUID(), nullable=False), sa.Column('phase_id', sa.GUID(), nullable=False), sa.Column('repository_id', sa.GUID(), nullable=False), sa.Column('project_id', sa.GUID(), nullable=False), sa.Column('label', sa.String(length=128), nullable=False), sa.Column('status', sa.Enum(), nullable=False), sa.Column('result', sa.Enum(), nullable=False), sa.Column('node_id', sa.GUID(), nullable=True), sa.Column('date_started', sa.DateTime(), nullable=True), sa.Column('date_finished', sa.DateTime(), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint( ['build_id'], ['build.id'], ), sa.ForeignKeyConstraint( ['node_id'], ['node.id'], ), sa.ForeignKeyConstraint( ['phase_id'], ['buildphase.id'], ), sa.ForeignKeyConstraint( ['project_id'], ['project.id'], ), sa.ForeignKeyConstraint( ['repository_id'], ['repository.id'], ), sa.PrimaryKeyConstraint('id')) op.drop_table(u'step') op.drop_table(u'phase')
def upgrade(): op.create_table( 'snapshot', sa.Column('id', sa.GUID(), nullable=False), sa.Column('project_id', sa.GUID(), nullable=False), sa.Column('build_id', sa.GUID(), nullable=True), sa.Column('status', sa.Enum(), server_default='0', nullable=False), sa.ForeignKeyConstraint( ['build_id'], ['build.id'], ), sa.ForeignKeyConstraint(['project_id'], ['project.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id'))
def upgrade(): op.create_table( 'comment', sa.Column('id', sa.GUID(), nullable=False), sa.Column('build_id', sa.GUID(), nullable=False), sa.Column('user_id', sa.GUID(), nullable=False), sa.Column('job_id', sa.GUID(), nullable=True), sa.Column('text', sa.Text(), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint(['build_id'], ['build.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['job_id'], ['job.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id'))
def upgrade(): op.create_table( 'bazeltarget', sa.Column('id', sa.GUID(), nullable=False), sa.Column('step_id', sa.GUID(), nullable=False), sa.Column('job_id', sa.GUID(), nullable=False), sa.Column('name', sa.Text(), nullable=False), sa.Column('status', sa.Enum(), nullable=False), sa.Column('result', sa.Enum(), nullable=False), sa.Column('duration', sa.Integer(), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=False), sa.ForeignKeyConstraint(['step_id'], ['jobstep.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['job_id'], ['job.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id'))
def upgrade(): op.create_table( 'projectoption', sa.Column('id', sa.GUID(), nullable=False), sa.Column('project_id', sa.GUID(), nullable=False), sa.Column('name', sa.String(length=64), nullable=False), sa.Column('value', sa.Text(), nullable=False), sa.Column('date_created', sa.DateTime(), nullable=False), sa.ForeignKeyConstraint( ['project_id'], ['project.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('project_id', 'name', name='unq_projectoption_name'))
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('phabricatordiff', sa.Column('id', sa.GUID(), nullable=False), sa.Column('diff_id', sa.Integer(), nullable=True), sa.Column('revision_id', sa.Integer(), nullable=True), sa.Column('source_id', sa.GUID(), nullable=True), sa.Column('url', sa.String(), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint( ['source_id'], ['source.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('diff_id'))
def upgrade(): op.create_table( 'source', sa.Column('id', sa.GUID(), nullable=False), sa.Column('repository_id', sa.GUID(), nullable=False), sa.Column('patch_id', sa.GUID(), nullable=True), sa.Column('revision_sha', sa.String(length=40), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint(['patch_id'], ['patch.id']), sa.ForeignKeyConstraint(['repository_id'], ['repository.id']), sa.PrimaryKeyConstraint('id')) op.add_column('build', sa.Column('source_id', sa.GUID(), nullable=True)) op.add_column('buildfamily', sa.Column('source_id', sa.GUID(), nullable=True)) op.create_index('idx_build_source_id', 'build', ['source_id']) op.create_index('idx_buildfamily_source_id', 'buildfamily', ['source_id'])
def upgrade(): connection = op.get_bind() logsources_table = table( 'logsource', sa.Column('id', sa.GUID(), nullable=False), sa.Column('build_id', sa.GUID(), nullable=False), sa.Column('name', sa.String(64), nullable=True), ) logchunks_table = table( 'logchunk', sa.Column('source_id', sa.GUID(), nullable=False), ) done = set() for logsource in connection.execute(logsources_table.select()): # migrate group to suite key = (logsource.build_id, logsource.name) if key in done: continue print("Checking LogSource %s - %s" % (logsource.build_id, logsource.name)) query = logchunks_table.delete().where( logchunks_table.c.source_id.in_( select([logchunks_table]).where( sa.and_( logsources_table.c.build_id == logsource.build_id, logsources_table.c.name == logsource.name, logsources_table.c.id != logsource.id, ), ))) connection.execute(query) query = logsources_table.delete().where( sa.and_( logsources_table.c.build_id == logsource.build_id, logsources_table.c.name == logsource.name, logsources_table.c.id != logsource.id, )) connection.execute(query) done.add(key) op.create_unique_constraint('unq_logsource_key', 'logsource', ['build_id', 'name']) op.drop_index('idx_logsource_build_id', 'logsource')
def upgrade(): op.add_column( 'travels', sa.Column('traveller_data_id', sa.GUID(), sa.ForeignKey('traveller_data.id', ondelete='CASCADE'), nullable=False))
def upgrade(): op.add_column( 'employee_travel_history', sa.Column('inbound_trip_id', sa.GUID(), sa.ForeignKey('travels.id', ondelete='CASCADE'), nullable=True))
def upgrade(): op.create_table( 'testartifact', sa.Column('id', sa.GUID(), nullable=False), sa.Column('test_id', sa.GUID(), nullable=False), sa.Column('name', sa.String(length=256), nullable=False), sa.Column('type', sa.Enum(), server_default='0', nullable=False), sa.Column('file', sa.FileStorage(), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint( ['test_id'], ['test.id'], ), sa.PrimaryKeyConstraint('id'), sa.Index('idx_test_id', 'test_id'), )
def upgrade(): op.create_table('user', sa.Column('id', sa.GUID(), nullable=False), sa.Column('email', sa.String(length=128), nullable=False), sa.Column('is_admin', sa.Boolean(), nullable=False), sa.Column('date_created', sa.DateTime(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('email'))
def upgrade(): op.add_column( 'jobplan', sa.Column('snapshot_image_id', sa.GUID(), sa.ForeignKey('snapshot_image.id', ondelete="RESTRICT"), nullable=True))
def upgrade(): op.create_table( 'testmessage', sa.Column('id', sa.GUID(), nullable=False), sa.Column('test_id', sa.GUID(), nullable=False), sa.Column('artifact_id', sa.GUID(), nullable=False), sa.Column('start_offset', sa.Integer(), nullable=False), sa.Column('length', sa.Integer(), nullable=False), sa.PrimaryKeyConstraint('id'), sa.ForeignKeyConstraint(['test_id'], ['test.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['artifact_id'], ['artifact.id'], ondelete='CASCADE'), ) op.create_index('idx_testmessage_test_id', 'testmessage', ['test_id'], unique=False)
def upgrade(): op.add_column('test', sa.Column('step_id', sa.GUID(), nullable=True)) op.create_foreign_key('test_step_id_fkey', 'test', 'jobstep', ['step_id'], ['id'], ondelete='CASCADE') op.create_index('idx_test_step_id', 'test', ['step_id'])
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table( 'snapshot_image', sa.Column('id', sa.GUID(), nullable=False), sa.Column('snapshot_id', sa.GUID(), nullable=False), sa.Column('plan_id', sa.GUID(), nullable=False), sa.Column('job_id', sa.GUID(), nullable=True, unique=True), sa.Column('date_created', sa.DateTime(), nullable=False), sa.ForeignKeyConstraint(['job_id'], ['job.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['plan_id'], ['plan.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['snapshot_id'], ['snapshot.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('snapshot_id', 'plan_id', name='unq_snapshotimage_plan') ) op.create_unique_constraint(None, 'snapshot', ['build_id'])
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('config', sa.Column('key', sa.String(length=255), nullable=False), sa.Column('value', sa.String(length=255), nullable=True), sa.PrimaryKeyConstraint('key') ) op.create_table('group', sa.Column('id', sa.GUID(), autoincrement=False, nullable=False), sa.Column('name', sa.String(length=255), nullable=False), sa.Column('state', sa.String(length=255), nullable=True), sa.Column('created_at', sa.DateTime(), nullable=False), sa.PrimaryKeyConstraint('id') ) op.create_table('user', sa.Column('id', sa.GUID(), autoincrement=False, nullable=False), sa.Column('first_name', sa.String(length=255), nullable=False), sa.Column('last_name', sa.String(length=255), nullable=False), sa.Column('gender', sa.String(length=255), nullable=False), sa.Column('locale', sa.String(length=255), nullable=False), sa.Column('timezone', sa.String(length=255), nullable=False), sa.Column('facebook_id', sa.BigInteger(), nullable=False), sa.Column('last_interaction', sa.DateTime(), nullable=False), sa.Column('state', sa.String(length=255), nullable=True), sa.Column('language', sa.String(length=3), nullable=True), sa.Column('gid', sa.GUID(), nullable=False), sa.ForeignKeyConstraint(['gid'], ['group.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('facebook_id') ) op.create_table('data', sa.Column('user', sa.GUID(), nullable=False), sa.Column('clz', sa.String(length=255), nullable=False), sa.Column('value', sa.Text(), nullable=True), sa.ForeignKeyConstraint(['user'], ['user.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('user', 'clz') ) op.create_table('log', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('user', sa.GUID(), nullable=False), sa.Column('direction', sa.String(length=1), nullable=True), sa.Column('message', sa.Text(), nullable=True), sa.Column('time', sa.DateTime(), nullable=False), sa.ForeignKeyConstraint(['user'], ['user.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id') )
def downgrade(): with op.batch_alter_table('employees') as bop: bop.drop_column('employee_spreadsheet_id') bop.add_column( sa.Column('user_id', sa.GUID(), sa.ForeignKey('users.id', ondelete='CASCADE'), nullable=False))
def upgrade(): op.create_table( 'itemsequence', sa.Column('parent_id', sa.GUID(), nullable=False), sa.Column('value', sa.Integer(), server_default='1', nullable=False), sa.PrimaryKeyConstraint('parent_id', 'value')) op.execute(NEXT_ITEM_VALUE_FUNCTION) op.execute(ADD_BUILD_SEQUENCES) op.execute(ADD_JOB_SEQUENCES)
def upgrade(): op.create_table('buildmessage', sa.Column('id', sa.GUID(), nullable=False), sa.Column('build_id', sa.GUID(), nullable=False), sa.Column('text', sa.Text(), nullable=False), sa.Column('date_created', sa.DateTime(), nullable=False), sa.ForeignKeyConstraint(['build_id'], ['build.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id') ) op.create_table('bazeltargetmessage', sa.Column('id', sa.GUID(), nullable=False), sa.Column('target_id', sa.GUID(), nullable=False), sa.Column('text', sa.Text(), nullable=False), sa.Column('date_created', sa.DateTime(), nullable=False), sa.ForeignKeyConstraint(['target_id'], ['bazeltarget.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id') )
def upgrade(): op.add_column( 'jobstep', sa.Column('replacement_id', sa.GUID(), sa.ForeignKey('jobstep.id', ondelete="CASCADE"), unique=True, nullable=True))
def upgrade(): op.create_table( 'buildseen', sa.Column('id', sa.GUID(), nullable=False), sa.Column('build_id', sa.GUID(), nullable=False), sa.Column('user_id', sa.GUID(), nullable=False), sa.Column('date_created', sa.DateTime(), nullable=False), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('build_id', 'user_id', name='unq_buildseen_entity')) op.create_foreign_key('buildseen_build_id_fkey', 'buildseen', 'build', ['build_id'], ['id'], ondelete='CASCADE') op.create_foreign_key('buildseen_user_id_fkey', 'buildseen', 'user', ['user_id'], ['id'], ondelete='CASCADE')
def upgrade(): op.create_table( 'artifact', sa.Column('id', sa.GUID(), nullable=False), sa.Column('job_id', sa.GUID(), nullable=False), sa.Column('step_id', sa.GUID(), nullable=False), sa.Column('project_id', sa.GUID(), nullable=False), sa.Column('name', sa.String(length=128), nullable=False), sa.Column('date_created', sa.DateTime(), nullable=True), sa.Column('data', sa.JSONEncodedDict(), nullable=True), sa.ForeignKeyConstraint(['job_id'], ['job.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['project_id'], ['project.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['step_id'], ['jobstep.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('step_id', 'name', name='unq_artifact_name'), )
def downgrade(): with op.batch_alter_table('traveller_data_errors') as bop: bop.add_column(sa.Column('row', sa.Integer(), nullable=False)) bop.drop_column('travel_id') bop.add_column( sa.Column('traveller_data_id', sa.GUID(), sa.ForeignKey('traveller_data.id', ondelete='CASCADE'), nullable=False))