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( '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 upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table( 'cluster', sa.Column('id', sa.GUID(), nullable=False), sa.Column('label', sa.String(length=128), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('label') ) op.create_table( 'cluster_node', sa.Column('cluster_id', sa.GUID(), nullable=False), sa.Column('node_id', sa.GUID(), nullable=False), sa.Column('date_created', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint(['cluster_id'], ['cluster.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['node_id'], ['node.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('cluster_id', 'node_id') ) op.add_column('node', sa.Column('data', sa.JSONEncodedDict(), nullable=True))
def upgrade(): op.create_table( 'command', sa.Column('id', sa.GUID(), nullable=False), sa.Column('jobstep_id', sa.GUID(), nullable=False), sa.Column('label', sa.String(length=128), nullable=False), sa.Column('status', sa.Enum(), nullable=False), sa.Column('return_code', sa.Integer(), nullable=False), sa.Column('script', sa.Text(), nullable=False), sa.Column('env', sa.String(length=2048), nullable=True), sa.Column('cwd', sa.String(length=256), nullable=True), sa.Column('artifacts', postgresql.ARRAY(sa.String(length=256)), 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.Column('data', sa.JSONEncodedDict(), nullable=True), sa.ForeignKeyConstraint( ['jobstep_id'], ['jobstep.id'], ), sa.PrimaryKeyConstraint('id'))
def upgrade(): op.add_column('jobstep', sa.Column('data', sa.JSONEncodedDict(), nullable=True))
def upgrade(): from changes.constants import Result testsuites_table = table( 'testsuite', sa.Column('id', sa.GUID(), nullable=False), sa.Column('build_id', sa.GUID(), nullable=False), sa.Column('project_id', sa.GUID(), nullable=False), sa.Column('name_sha', sa.String(length=40), nullable=False), sa.Column('name', sa.Text(), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), ) testgroups_table = table( 'testgroup', sa.Column('id', sa.GUID(), nullable=False), sa.Column('build_id', sa.GUID(), nullable=False), sa.Column('project_id', sa.GUID(), nullable=False), sa.Column('name_sha', sa.String(length=40), nullable=False), sa.Column('duration', sa.Integer(), nullable=True), sa.Column('num_tests', sa.Integer(), nullable=True), sa.Column('num_failed', sa.Integer(), nullable=True), sa.Column('name', sa.Text(), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), ) testgroups_m2m_table = table( 'testgroup_test', sa.Column('group_id', sa.GUID(), nullable=False), sa.Column('test_id', sa.GUID(), nullable=False), ) testcases_table = table( 'test', sa.Column('id', sa.GUID(), nullable=False), sa.Column('build_id', sa.GUID(), nullable=False), sa.Column('project_id', sa.GUID(), nullable=False), sa.Column('package', sa.Text(), nullable=True), sa.Column('name', sa.Text(), nullable=True), sa.Column('group', sa.Text(), nullable=True), sa.Column('suite_id', sa.GUID(), nullable=True), sa.Column('duration', sa.Integer(), nullable=True), sa.Column('result', sa.Enum(), nullable=True), ) connection = op.get_bind() ### commands auto generated by Alembic - please adjust! ### op.create_table( 'testsuite', sa.Column('id', sa.GUID(), nullable=False), sa.Column('build_id', sa.GUID(), nullable=False), sa.Column('project_id', sa.GUID(), nullable=False), sa.Column('name_sha', sa.String(length=40), nullable=False), sa.Column('name', sa.Text(), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint( ['build_id'], ['build.id'], ), sa.ForeignKeyConstraint( ['project_id'], ['project.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('build_id', 'name_sha', name='_suite_key')) op.create_table( 'testgroup', sa.Column('id', sa.GUID(), nullable=False), sa.Column('build_id', sa.GUID(), nullable=False), sa.Column('project_id', sa.GUID(), nullable=False), sa.Column('suite_id', sa.GUID(), nullable=True), sa.Column('parent_id', sa.GUID(), nullable=True), sa.Column('name_sha', sa.String(length=40), nullable=False), sa.Column('name', sa.Text(), nullable=True), sa.Column('duration', sa.Integer(), default=0, nullable=True), sa.Column('num_tests', sa.Integer(), default=0, nullable=True), sa.Column('num_failed', sa.Integer(), default=0, nullable=True), sa.Column('data', sa.JSONEncodedDict(), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint( ['build_id'], ['build.id'], ), sa.ForeignKeyConstraint( ['parent_id'], ['testgroup.id'], ), sa.ForeignKeyConstraint( ['project_id'], ['project.id'], ), sa.ForeignKeyConstraint( ['suite_id'], ['testsuite.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('build_id', 'suite_id', 'name_sha', name='_group_key')) op.create_table('testgroup_test', sa.Column('group_id', sa.GUID(), nullable=False), sa.Column('test_id', sa.GUID(), nullable=False), sa.ForeignKeyConstraint( ['group_id'], ['testgroup.id'], ), sa.ForeignKeyConstraint( ['test_id'], ['test.id'], ), sa.PrimaryKeyConstraint('group_id', 'test_id')) op.add_column(u'test', sa.Column('suite_id', sa.GUID(), nullable=True)) # perform data migrations for testcase in connection.execute(testcases_table.select()): # migrate group to suite print("Migrating TestCase %s" % (testcase.id, )) suite_name = testcase.group or 'default' suite_sha = sha1(suite_name).hexdigest() result = connection.execute(testsuites_table.select().where( sa.and_( testsuites_table.c.build_id == testcase.build_id, testsuites_table.c.name_sha == suite_sha, )).limit(1)).fetchone() if not result: suite_id = uuid4() connection.execute(testsuites_table.insert().values( id=suite_id, build_id=testcase.build_id, project_id=testcase.project_id, name=suite_name, name_sha=suite_sha, date_created=datetime.utcnow(), )) else: suite_id = result[0] connection.execute(testcases_table.update().where( testcases_table.c.id == testcase.id, ).values({ testcases_table.c.suite_id: suite_id, })) # add package as group group_name = testcase.package or testcase.name.rsplit('.', 1)[1] group_sha = sha1(group_name).hexdigest() result = connection.execute(testgroups_table.select().where( sa.and_( testgroups_table.c.build_id == testcase.build_id, testgroups_table.c.name_sha == group_sha, )).limit(1)).fetchone() if not result: group_id = uuid4() connection.execute(testgroups_table.insert().values( id=group_id, build_id=testcase.build_id, project_id=testcase.project_id, name=group_name, name_sha=group_sha, date_created=datetime.utcnow(), duration=0, num_tests=0, num_failed=0, )) else: group_id = result[0] update_values = { testgroups_table.c.num_tests: testgroups_table.c.num_tests + 1, testgroups_table.c.duration: testgroups_table.c.duration + testcase.duration, } if testcase.result == Result.failed.value: update_values[testgroups_table.c. num_failed] = testgroups_table.c.num_failed + 1 connection.execute(testgroups_m2m_table.insert().values({ testgroups_m2m_table.c.group_id: group_id, testgroups_m2m_table.c.test_id: testcase.id, })) connection.execute(testgroups_table.update().where( testgroups_table.c.id == group_id, ).values(update_values)) op.drop_column(u'test', u'group') op.drop_column(u'test', u'group_sha')
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('user', sa.Column('id', sa.Integer(), nullable=False), sa.Column('username', sa.String(length=255), nullable=True), sa.Column('email', sa.String(length=255), nullable=True), sa.Column('password', sa.String(length=255), nullable=True), sa.Column('active', sa.Boolean(), nullable=True), sa.Column('confirmed_at', sa.DateTime(timezone=True), nullable=True), sa.Column('hashkey', sa.String(length=255), nullable=True), sa.Column('created', sa.DateTime(timezone=True), nullable=True), sa.Column('updated', sa.DateTime(timezone=True), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('email'), sa.UniqueConstraint('hashkey'), sa.UniqueConstraint('username') ) op.create_table('role', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=255), nullable=True), sa.Column('description', sa.String(length=255), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name') ) op.create_table('useritem', sa.Column('id', sa.Integer(), nullable=False), sa.Column('version', sa.Integer(), nullable=True), sa.Column('type', sa.String(length=50), nullable=True), sa.Column('created', sa.DateTime(timezone=True), nullable=True), sa.Column('updated', sa.DateTime(timezone=True), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_table('plugins', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=255), nullable=True), sa.Column('hashkey', sa.String(length=255), nullable=True), sa.ForeignKeyConstraint(['id'], ['useritem.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('hashkey'), sa.UniqueConstraint('name') ) op.create_table('authorization', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=255), nullable=True), sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('version', sa.Integer(), nullable=True), sa.Column('oauth_token', sa.String(length=255), nullable=True), sa.Column('oauth_token_secret', sa.String(length=255), nullable=True), sa.Column('access_token', sa.String(length=255), nullable=True), sa.Column('refresh_token', sa.String(length=255), nullable=True), sa.Column('expires_in', sa.String(length=255), nullable=True), sa.Column('created', sa.DateTime(timezone=True), nullable=True), sa.Column('updated', sa.DateTime(timezone=True), nullable=True), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('user_id', 'name') ) op.create_table('metrics', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=255), nullable=True), sa.Column('hashkey', sa.String(length=255), nullable=True), sa.ForeignKeyConstraint(['id'], ['useritem.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('hashkey'), sa.UniqueConstraint('name') ) op.create_table('sources', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=255), nullable=True), sa.Column('hashkey', sa.String(length=255), nullable=True), sa.ForeignKeyConstraint(['id'], ['useritem.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('hashkey'), sa.UniqueConstraint('name') ) op.create_table('userprofile', sa.Column('id', sa.Integer(), nullable=False), sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('first_name', sa.String(length=255), nullable=True), sa.Column('last_name', sa.String(length=255), nullable=True), sa.Column('timezone', sa.Text(), nullable=True), sa.Column('settings', sa.JSONEncodedDict(), nullable=True), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_table('groups', sa.Column('id', sa.Integer(), nullable=False), sa.Column('owner_id', sa.Integer(), nullable=True), sa.Column('hashkey', sa.String(length=255), nullable=True), sa.Column('name', sa.String(length=255), nullable=True), sa.Column('description', sa.Text(), nullable=True), sa.Column('created', sa.DateTime(timezone=True), nullable=True), sa.Column('updated', sa.DateTime(timezone=True), nullable=True), sa.ForeignKeyConstraint(['owner_id'], ['user.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('hashkey'), sa.UniqueConstraint('name') ) op.create_table('roles_users', sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('role_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['role_id'], ['role.id'], ), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ) ) op.create_table('groupprofile', sa.Column('id', sa.Integer(), nullable=False), sa.Column('group_id', sa.Integer(), nullable=True), sa.Column('timezone', sa.Text(), nullable=True), sa.Column('settings', sa.JSONEncodedDict(), nullable=True), sa.ForeignKeyConstraint(['group_id'], ['groups.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_table('user_plugins', sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('plugin_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['plugin_id'], ['plugins.id'], ), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ) ) op.create_table('group_plugins', sa.Column('group_id', sa.Integer(), nullable=True), sa.Column('plugin_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['group_id'], ['groups.id'], ), sa.ForeignKeyConstraint(['plugin_id'], ['plugins.id'], ) ) op.create_table('permissions', sa.Column('id', sa.Integer(), nullable=False), sa.Column('version', sa.Integer(), nullable=True), sa.Column('scope', sa.String(length=255), nullable=True), sa.Column('public', sa.Boolean(), nullable=True), sa.Column('hashkey', sa.String(length=255), nullable=True), sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('group_id', sa.Integer(), nullable=True), sa.Column('created', sa.DateTime(timezone=True), nullable=True), sa.Column('updated', sa.DateTime(timezone=True), nullable=True), sa.ForeignKeyConstraint(['group_id'], ['groups.id'], ), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('hashkey') ) op.create_table('user_metrics', sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('metric_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['metric_id'], ['metrics.id'], ), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ) ) op.create_table('pluginmodels', sa.Column('id', sa.Integer(), nullable=False), sa.Column('version', sa.Integer(), nullable=True), sa.Column('name', sa.String(length=255), nullable=True), sa.Column('hashkey', sa.String(length=255), nullable=True), sa.Column('plugin_id', sa.String(length=255), nullable=True), sa.Column('metric_id', sa.String(length=255), nullable=True), sa.Column('created', sa.DateTime(timezone=True), nullable=True), sa.Column('updated', sa.DateTime(timezone=True), nullable=True), sa.ForeignKeyConstraint(['metric_id'], ['metrics.name'], ), sa.ForeignKeyConstraint(['plugin_id'], ['plugins.hashkey'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('hashkey'), sa.UniqueConstraint('metric_id', 'plugin_id'), sa.UniqueConstraint('name', 'plugin_id') ) op.create_table('user_sources', sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('source_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['source_id'], ['sources.id'], ), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ) ) op.create_table('user_groups', sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('group_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['group_id'], ['groups.id'], ), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ) ) op.create_table('resourcedata', sa.Column('id', sa.Integer(), nullable=False), sa.Column('version', sa.Integer(), nullable=True), sa.Column('name', sa.String(length=255), nullable=True), sa.Column('type', sa.String(length=255), nullable=True), sa.Column('hashkey', sa.String(length=255), nullable=True), sa.Column('settings', sa.JSONEncodedDict(), nullable=True), sa.Column('author_email', sa.Text(), nullable=True), sa.Column('current_view', sa.String(length=255), nullable=True), sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('group_id', sa.Integer(), nullable=True), sa.Column('created', sa.DateTime(timezone=True), nullable=True), sa.Column('updated', sa.DateTime(timezone=True), nullable=True), sa.ForeignKeyConstraint(['group_id'], ['groups.id'], ), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('hashkey') ) op.create_table('pluginviews', sa.Column('id', sa.Integer(), nullable=False), sa.Column('version', sa.Integer(), nullable=True), sa.Column('name', sa.String(length=255), nullable=True), sa.Column('hashkey', sa.String(length=255), nullable=True), sa.Column('plugin_id', sa.String(length=255), nullable=True), sa.Column('created', sa.DateTime(timezone=True), nullable=True), sa.Column('updated', sa.DateTime(timezone=True), nullable=True), sa.ForeignKeyConstraint(['plugin_id'], ['plugins.hashkey'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('hashkey'), sa.UniqueConstraint('name', 'plugin_id') ) op.create_table('resource_views', sa.Column('resourcedata_id', sa.Integer(), nullable=True), sa.Column('pluginview_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['pluginview_id'], ['pluginviews.id'], ), sa.ForeignKeyConstraint(['resourcedata_id'], ['resourcedata.id'], ) ) op.create_table('resource_permissions', sa.Column('resourcedata_id', sa.Integer(), nullable=True), sa.Column('permission_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['permission_id'], ['permissions.id'], ), sa.ForeignKeyConstraint(['resourcedata_id'], ['resourcedata.id'], ) ) op.create_table('plugindata', sa.Column('id', sa.Integer(), nullable=False), sa.Column('plugin_id', sa.String(length=255), nullable=True), sa.Column('metric_id', sa.String(length=255), nullable=True), sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('group_id', sa.Integer(), nullable=True), sa.Column('source_id', sa.String(length=255), nullable=True), sa.Column('plugin_model_id', sa.String(length=255), nullable=True), sa.Column('date', sa.DateTime(timezone=True), nullable=True), sa.Column('data', sa.JSONEncodedDict(), nullable=True), sa.Column('hashkey', sa.String(length=255), nullable=True), sa.Column('created', sa.DateTime(timezone=True), nullable=True), sa.Column('updated', sa.DateTime(timezone=True), nullable=True), sa.ForeignKeyConstraint(['group_id'], ['groups.id'], ), sa.ForeignKeyConstraint(['metric_id'], ['metrics.name'], ), sa.ForeignKeyConstraint(['plugin_id'], ['plugins.hashkey'], ), sa.ForeignKeyConstraint(['plugin_model_id'], ['pluginmodels.hashkey'], ), sa.ForeignKeyConstraint(['source_id'], ['sources.name'], ), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('plugin_id', 'metric_id', 'user_id', 'hashkey') ) op.create_table('resource_related', sa.Column('parent_id', sa.Integer(), nullable=True), sa.Column('related_id', sa.Integer(), nullable=True), sa.Column('col', sa.Integer(), nullable=True), sa.Column('row', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['parent_id'], ['resourcedata.id'], ), sa.ForeignKeyConstraint(['related_id'], ['resourcedata.id'], ) ) op.create_table('resourcelayout', sa.Column('id', sa.Integer(), nullable=False), sa.Column('resourcedata_id', sa.Integer(), nullable=True), sa.Column('sizeX', sa.Integer(), nullable=True), sa.Column('sizeY', sa.Integer(), nullable=True), sa.Column('row', sa.Integer(), nullable=True), sa.Column('col', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['resourcedata_id'], ['resourcedata.id'], ), sa.PrimaryKeyConstraint('id') )
def upgrade(): op.add_column('failurereason', sa.Column('data', sa.JSONEncodedDict(), nullable=True))
def upgrade(): op.create_table( 'plan', sa.Column('id', sa.GUID(), nullable=False), sa.Column('label', sa.String(length=128), nullable=False), sa.Column('date_created', sa.DateTime(), nullable=False), sa.Column('date_modified', sa.DateTime(), nullable=False), sa.Column('data', sa.JSONEncodedDict(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_table( 'step', sa.Column('id', sa.GUID(), nullable=False), sa.Column('plan_id', sa.GUID(), nullable=False), sa.Column('date_created', sa.DateTime(), nullable=False), sa.Column('date_modified', sa.DateTime(), nullable=False), sa.Column('implementation', sa.String(length=128), nullable=False), sa.Column('order', sa.Integer(), nullable=False), sa.Column('data', sa.JSONEncodedDict(), nullable=True), sa.CheckConstraint('step."order" >= 0', name='chk_step_order_positive'), sa.ForeignKeyConstraint(['plan_id'], ['plan.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index('idx_step_plan_id', 'step', ['plan_id']) op.create_table( 'buildfamily', sa.Column('id', sa.GUID(), nullable=False), sa.Column('project_id', sa.GUID(), nullable=False), sa.Column('repository_id', sa.GUID(), nullable=False), sa.Column('revision_sha', sa.String(length=40), nullable=True), sa.Column('patch_id', sa.GUID(), nullable=True), sa.Column('author_id', sa.GUID(), nullable=True), sa.Column('cause', sa.Enum(), nullable=False), sa.Column('label', sa.String(length=128), nullable=False), sa.Column('target', sa.String(length=128), nullable=True), sa.Column('status', sa.Enum(), nullable=False), sa.Column('result', sa.Enum(), nullable=False), sa.Column('message', sa.Text(), nullable=True), sa.Column('duration', sa.Integer(), 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.Column('date_modified', sa.DateTime(), nullable=True), sa.Column('data', sa.JSONEncodedDict(), nullable=True), sa.ForeignKeyConstraint(['author_id'], ['author.id'], ), sa.ForeignKeyConstraint(['patch_id'], ['patch.id'], ), sa.ForeignKeyConstraint(['project_id'], ['project.id'], ), sa.ForeignKeyConstraint(['repository_id'], ['repository.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index('idx_buildfamily_project_id', 'buildfamily', ['project_id']) op.create_index('idx_buildfamily_repository_revision', 'buildfamily', ['repository_id', 'revision_sha']) op.create_index('idx_buildfamily_patch_id', 'buildfamily', ['patch_id']) op.create_index('idx_buildfamily_author_id', 'buildfamily', ['author_id']) op.create_table( 'buildplan', sa.Column('id', sa.GUID(), nullable=False), sa.Column('project_id', sa.GUID(), nullable=False), sa.Column('family_id', sa.GUID(), nullable=False), sa.Column('build_id', sa.GUID(), nullable=False), sa.Column('plan_id', sa.GUID(), nullable=False), sa.Column('date_created', sa.DateTime(), nullable=True), sa.Column('date_modified', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint(['build_id'], ['build.id'], ), sa.ForeignKeyConstraint(['family_id'], ['buildfamily.id'], ), sa.ForeignKeyConstraint(['plan_id'], ['plan.id'], ), sa.ForeignKeyConstraint(['project_id'], ['project.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index('idx_buildplan_project_id', 'buildplan', ['project_id']) op.create_index('idx_buildplan_family_id', 'buildplan', ['family_id']) op.create_index('idx_buildplan_build_id', 'buildplan', ['build_id']) op.create_index('idx_buildplan_plan_id', 'buildplan', ['plan_id'])
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('repository', sa.Column('id', sa.GUID(), nullable=False), sa.Column('url', sa.String(length=200), nullable=False), sa.Column('date_created', sa.DateTime(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('url')) op.create_table('node', sa.Column('id', sa.GUID(), nullable=False), sa.Column('label', sa.String(length=128), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.PrimaryKeyConstraint('id')) op.create_table('author', sa.Column('id', sa.GUID(), nullable=False), sa.Column('name', sa.String(length=128), nullable=False), sa.Column('email', sa.String(length=128), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('email'), sa.UniqueConstraint('name')) op.create_table( 'remoteentity', sa.Column('id', sa.GUID(), nullable=False), sa.Column('type', sa.String(), nullable=False), sa.Column('provider', sa.String(length=128), nullable=False), sa.Column('remote_id', sa.String(length=128), nullable=False), sa.Column('internal_id', sa.GUID(), nullable=False), sa.Column('data', sa.JSONEncodedDict(), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('provider', 'remote_id', 'type', name='remote_identifier')) op.create_table( 'project', sa.Column('id', sa.GUID(), nullable=False), sa.Column('slug', sa.String(length=64), nullable=False), sa.Column('repository_id', sa.GUID(), nullable=False), sa.Column('name', sa.String(length=64), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.Column('avg_build_time', sa.Integer(), nullable=True), sa.ForeignKeyConstraint( ['repository_id'], ['repository.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('slug')) op.create_table( 'revision', sa.Column('repository_id', sa.GUID(), nullable=False), sa.Column('sha', sa.String(length=40), nullable=False), sa.Column('author_id', sa.GUID(), nullable=True), sa.Column('message', sa.Text(), nullable=True), sa.Column('parents', postgresql.ARRAY(sa.String(length=40)), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint( ['author_id'], ['author.id'], ), sa.ForeignKeyConstraint( ['repository_id'], ['repository.id'], ), sa.PrimaryKeyConstraint('repository_id', 'sha')) op.create_table( 'change', sa.Column('id', sa.GUID(), nullable=False), sa.Column('hash', sa.String(length=40), nullable=False), sa.Column('repository_id', sa.GUID(), nullable=False), sa.Column('project_id', sa.GUID(), nullable=False), sa.Column('author_id', sa.GUID(), nullable=True), sa.Column('label', sa.String(length=128), nullable=False), sa.Column('message', sa.Text(), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.Column('date_modified', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint( ['author_id'], ['author.id'], ), sa.ForeignKeyConstraint( ['project_id'], ['project.id'], ), sa.ForeignKeyConstraint( ['repository_id'], ['repository.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('hash')) op.create_table( 'patch', sa.Column('id', sa.GUID(), nullable=False), sa.Column('change_id', sa.GUID(), nullable=True), sa.Column('repository_id', sa.GUID(), nullable=False), sa.Column('project_id', sa.GUID(), nullable=False), sa.Column('parent_revision_sha', sa.String(length=40), nullable=False), sa.Column('label', sa.String(length=64), nullable=False), sa.Column('url', sa.String(length=200), nullable=True), sa.Column('diff', sa.Text(), nullable=True), sa.Column('message', sa.Text(), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint( ['change_id'], ['change.id'], ), sa.ForeignKeyConstraint( ['project_id'], ['project.id'], ), sa.ForeignKeyConstraint( ['repository_id'], ['repository.id'], ), sa.PrimaryKeyConstraint('id')) op.create_table( 'build', sa.Column('id', sa.GUID(), nullable=False), sa.Column('change_id', sa.GUID(), nullable=True), sa.Column('repository_id', sa.GUID(), nullable=False), sa.Column('project_id', sa.GUID(), nullable=False), sa.Column('parent_revision_sha', sa.String(length=40), nullable=True), sa.Column('patch_id', sa.GUID(), nullable=True), sa.Column('author_id', sa.GUID(), nullable=True), 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('message', sa.Text(), nullable=True), sa.Column('duration', sa.Integer(), 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.Column('date_modified', sa.DateTime(), nullable=True), sa.Column('data', sa.JSONEncodedDict(), nullable=True), sa.ForeignKeyConstraint( ['author_id'], ['author.id'], ), sa.ForeignKeyConstraint( ['change_id'], ['change.id'], ), sa.ForeignKeyConstraint( ['patch_id'], ['patch.id'], ), sa.ForeignKeyConstraint( ['project_id'], ['project.id'], ), sa.ForeignKeyConstraint( ['repository_id'], ['repository.id'], ), sa.PrimaryKeyConstraint('id')) op.create_table( 'filecoverage', sa.Column('id', sa.GUID(), nullable=False), sa.Column('build_id', sa.GUID(), nullable=False), sa.Column('filename', sa.String(length=256), nullable=False), sa.Column('project_id', sa.Integer(), nullable=False), sa.Column('data', sa.Text(), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint( ['build_id'], ['build.id'], ), sa.PrimaryKeyConstraint('id', 'filename')) op.create_table( 'test', sa.Column('id', sa.GUID(), nullable=False), sa.Column('build_id', sa.GUID(), nullable=False), sa.Column('project_id', sa.GUID(), nullable=False), sa.Column('group_sha', sa.String(length=40), nullable=False), sa.Column('label_sha', sa.String(length=40), nullable=False), sa.Column('group', sa.Text(), nullable=False), sa.Column('name', sa.Text(), nullable=False), sa.Column('package', sa.Text(), nullable=True), sa.Column('result', sa.Enum(), nullable=True), sa.Column('duration', sa.Integer(), nullable=True), sa.Column('message', sa.Text(), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint( ['build_id'], ['build.id'], ), sa.ForeignKeyConstraint( ['project_id'], ['project.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('build_id', 'group_sha', 'label_sha', name='_test_key')) op.create_table( 'phase', 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( 'step', 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'], ['phase.id'], ), sa.ForeignKeyConstraint( ['project_id'], ['project.id'], ), sa.ForeignKeyConstraint( ['repository_id'], ['repository.id'], ), sa.PrimaryKeyConstraint('id'))