def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'tagtorepositorytag', sa.Column('id', sa.Integer(), nullable=False), sa.Column('repository_id', sa.Integer(), nullable=False), sa.Column('tag_id', sa.Integer(), nullable=False), sa.Column('repository_tag_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint( ['repository_id'], ['repository.id'], name=op.f('fk_tagtorepositorytag_repository_id_repository')), sa.ForeignKeyConstraint( ['repository_tag_id'], ['repositorytag.id'], name=op.f( 'fk_tagtorepositorytag_repository_tag_id_repositorytag')), sa.ForeignKeyConstraint(['tag_id'], ['tag.id'], name=op.f('fk_tagtorepositorytag_tag_id_tag')), sa.PrimaryKeyConstraint('id', name=op.f('pk_tagtorepositorytag'))) op.create_index('tagtorepositorytag_repository_id', 'tagtorepositorytag', ['repository_id'], unique=False) op.create_index('tagtorepositorytag_repository_tag_id', 'tagtorepositorytag', ['repository_tag_id'], unique=True) op.create_index('tagtorepositorytag_tag_id', 'tagtorepositorytag', ['tag_id'], unique=True) # ### end Alembic commands ### tester.populate_table('tagtorepositorytag', [ ('repository_id', tester.TestDataType.Foreign('repository')), ('tag_id', tester.TestDataType.Foreign('tag')), ('repository_tag_id', tester.TestDataType.Foreign('repositorytag')), ])
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # ### commands auto generated by Alembic - please adjust! ### op.create_table( "deletedrepository", sa.Column("id", sa.Integer(), nullable=False), sa.Column("repository_id", sa.Integer(), nullable=False), sa.Column("marked", sa.DateTime(), nullable=False), sa.Column("original_name", sa.String(length=255), nullable=False), sa.Column("queue_id", sa.String(length=255), nullable=True), sa.ForeignKeyConstraint( ["repository_id"], ["repository.id"], name=op.f("fk_deletedrepository_repository_id_repository"), ), sa.PrimaryKeyConstraint("id", name=op.f("pk_deletedrepository")), ) op.create_index("deletedrepository_original_name", "deletedrepository", ["original_name"], unique=False) op.create_index("deletedrepository_queue_id", "deletedrepository", ["queue_id"], unique=False) op.create_index("deletedrepository_repository_id", "deletedrepository", ["repository_id"], unique=True)
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # ### commands auto generated by Alembic - please adjust! ### op.create_table( "appspecificauthtoken", sa.Column("id", sa.Integer(), nullable=False), sa.Column("user_id", sa.Integer(), nullable=False), sa.Column("uuid", sa.String(length=36), nullable=False), sa.Column("title", UTF8CharField(length=255), nullable=False), sa.Column("token_code", sa.String(length=255), nullable=False), sa.Column("created", sa.DateTime(), nullable=False), sa.Column("expiration", sa.DateTime(), nullable=True), sa.Column("last_accessed", sa.DateTime(), nullable=True), sa.ForeignKeyConstraint( ["user_id"], ["user.id"], name=op.f("fk_appspecificauthtoken_user_id_user")), sa.PrimaryKeyConstraint("id", name=op.f("pk_appspecificauthtoken")), ) op.create_index("appspecificauthtoken_token_code", "appspecificauthtoken", ["token_code"], unique=True) op.create_index("appspecificauthtoken_user_id", "appspecificauthtoken", ["user_id"], unique=False) op.create_index( "appspecificauthtoken_user_id_expiration", "appspecificauthtoken", ["user_id", "expiration"], unique=False, ) op.create_index("appspecificauthtoken_uuid", "appspecificauthtoken", ["uuid"], unique=False) # ### end Alembic commands ### op.bulk_insert( tables.logentrykind, [ { "name": "create_app_specific_token" }, { "name": "revoke_app_specific_token" }, ], ) # ### population of test data ### # tester.populate_table( "appspecificauthtoken", [ ("user_id", tester.TestDataType.Foreign("user")), ("uuid", tester.TestDataType.UUID), ("title", tester.TestDataType.UTF8Char), ("token_code", tester.TestDataType.String), ("created", tester.TestDataType.DateTime), ("expiration", tester.TestDataType.DateTime), ("last_accessed", tester.TestDataType.DateTime), ], )
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) ### commands auto generated by Alembic - please adjust! ### op.create_table( 'repositorysearchscore', sa.Column('id', sa.Integer(), nullable=False), sa.Column('repository_id', sa.Integer(), nullable=False), sa.Column('score', sa.BigInteger(), nullable=False), sa.Column('last_updated', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint( ['repository_id'], ['repository.id'], name=op.f('fk_repositorysearchscore_repository_id_repository')), sa.PrimaryKeyConstraint('id', name=op.f('pk_repositorysearchscore'))) op.create_index('repositorysearchscore_repository_id', 'repositorysearchscore', ['repository_id'], unique=True) op.create_index('repositorysearchscore_score', 'repositorysearchscore', ['score'], unique=False) ### end Alembic commands ### # ### population of test data ### # tester.populate_table('repositorysearchscore', [ ('repository_id', tester.TestDataType.Foreign('repository')), ('score', tester.TestDataType.BigInteger), ('last_updated', tester.TestDataType.DateTime), ])
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) ### commands auto generated by Alembic - please adjust! ### op.create_table( 'teamsync', sa.Column('id', sa.Integer(), nullable=False), sa.Column('team_id', sa.Integer(), nullable=False), sa.Column('transaction_id', sa.String(length=255), nullable=False), sa.Column('last_updated', sa.DateTime(), nullable=True), sa.Column('service_id', sa.Integer(), nullable=False), sa.Column('config', UTF8LongText(), nullable=False), sa.ForeignKeyConstraint( ['service_id'], ['loginservice.id'], name=op.f('fk_teamsync_service_id_loginservice')), sa.ForeignKeyConstraint(['team_id'], ['team.id'], name=op.f('fk_teamsync_team_id_team')), sa.PrimaryKeyConstraint('id', name=op.f('pk_teamsync'))) op.create_index('teamsync_last_updated', 'teamsync', ['last_updated'], unique=False) op.create_index('teamsync_service_id', 'teamsync', ['service_id'], unique=False) op.create_index('teamsync_team_id', 'teamsync', ['team_id'], unique=True) ### end Alembic commands ### # ### population of test data ### # tester.populate_table('teamsync', [ ('team_id', tester.TestDataType.Foreign('team')), ('transaction_id', tester.TestDataType.String), ('last_updated', tester.TestDataType.DateTime), ('service_id', tester.TestDataType.Foreign('loginservice')), ('config', tester.TestDataType.JSON), ])
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # ### commands auto generated by Alembic - please adjust! ### op.create_table( "robotaccountmetadata", sa.Column("id", sa.Integer(), nullable=False), sa.Column("robot_account_id", sa.Integer(), nullable=False), sa.Column("description", UTF8CharField(length=255), nullable=False), sa.Column("unstructured_json", sa.Text(), nullable=False), sa.ForeignKeyConstraint( ["robot_account_id"], ["user.id"], name=op.f("fk_robotaccountmetadata_robot_account_id_user"), ), sa.PrimaryKeyConstraint("id", name=op.f("pk_robotaccountmetadata")), ) op.create_index( "robotaccountmetadata_robot_account_id", "robotaccountmetadata", ["robot_account_id"], unique=True, ) # ### end Alembic commands ### # ### population of test data ### # tester.populate_table( "robotaccountmetadata", [ ("robot_account_id", tester.TestDataType.Foreign("user")), ("description", tester.TestDataType.UTF8Char), ("unstructured_json", tester.TestDataType.JSON), ], )
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) ### commands auto generated by Alembic - please adjust! ### op.create_table( "teamsync", sa.Column("id", sa.Integer(), nullable=False), sa.Column("team_id", sa.Integer(), nullable=False), sa.Column("transaction_id", sa.String(length=255), nullable=False), sa.Column("last_updated", sa.DateTime(), nullable=True), sa.Column("service_id", sa.Integer(), nullable=False), sa.Column("config", UTF8LongText(), nullable=False), sa.ForeignKeyConstraint( ["service_id"], ["loginservice.id"], name=op.f("fk_teamsync_service_id_loginservice") ), sa.ForeignKeyConstraint(["team_id"], ["team.id"], name=op.f("fk_teamsync_team_id_team")), sa.PrimaryKeyConstraint("id", name=op.f("pk_teamsync")), ) op.create_index("teamsync_last_updated", "teamsync", ["last_updated"], unique=False) op.create_index("teamsync_service_id", "teamsync", ["service_id"], unique=False) op.create_index("teamsync_team_id", "teamsync", ["team_id"], unique=True) ### end Alembic commands ### # ### population of test data ### # tester.populate_table( "teamsync", [ ("team_id", tester.TestDataType.Foreign("team")), ("transaction_id", tester.TestDataType.String), ("last_updated", tester.TestDataType.DateTime), ("service_id", tester.TestDataType.Foreign("loginservice")), ("config", tester.TestDataType.JSON), ], )
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) ### commands auto generated by Alembic - please adjust! ### op.create_table( "repositorysearchscore", sa.Column("id", sa.Integer(), nullable=False), sa.Column("repository_id", sa.Integer(), nullable=False), sa.Column("score", sa.BigInteger(), nullable=False), sa.Column("last_updated", sa.DateTime(), nullable=True), sa.ForeignKeyConstraint( ["repository_id"], ["repository.id"], name=op.f("fk_repositorysearchscore_repository_id_repository"), ), sa.PrimaryKeyConstraint("id", name=op.f("pk_repositorysearchscore")), ) op.create_index( "repositorysearchscore_repository_id", "repositorysearchscore", ["repository_id"], unique=True, ) op.create_index("repositorysearchscore_score", "repositorysearchscore", ["score"], unique=False) ### end Alembic commands ### # ### population of test data ### # tester.populate_table( "repositorysearchscore", [ ("repository_id", tester.TestDataType.Foreign("repository")), ("score", tester.TestDataType.BigInteger), ("last_updated", tester.TestDataType.DateTime), ], )
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # ### commands auto generated by Alembic - please adjust! ### op.create_table( "disablereason", sa.Column("id", sa.Integer(), nullable=False), sa.Column("name", sa.String(length=255), nullable=False), sa.PrimaryKeyConstraint("id", name=op.f("pk_disablereason")), ) op.create_index("disablereason_name", "disablereason", ["name"], unique=True) op.bulk_insert( tables.disablereason, [ { "id": 1, "name": "user_toggled" }, ], ) op.bulk_insert(tables.logentrykind, [ { "name": "toggle_repo_trigger" }, ]) op.add_column(u"repositorybuildtrigger", sa.Column("disabled_reason_id", sa.Integer(), nullable=True)) op.add_column( u"repositorybuildtrigger", sa.Column("enabled", sa.Boolean(), nullable=False, server_default=sa.sql.expression.true()), ) op.create_index( "repositorybuildtrigger_disabled_reason_id", "repositorybuildtrigger", ["disabled_reason_id"], unique=False, ) op.create_foreign_key( op.f("fk_repositorybuildtrigger_disabled_reason_id_disablereason"), "repositorybuildtrigger", "disablereason", ["disabled_reason_id"], ["id"], ) # ### end Alembic commands ### # ### population of test data ### # tester.populate_column("repositorybuildtrigger", "disabled_reason_id", tester.TestDataType.Foreign("disablereason")) tester.populate_column("repositorybuildtrigger", "enabled", tester.TestDataType.Boolean)
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'disablereason', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=255), nullable=False), sa.PrimaryKeyConstraint('id', name=op.f('pk_disablereason'))) op.create_index('disablereason_name', 'disablereason', ['name'], unique=True) op.bulk_insert( tables.disablereason, [ { 'id': 1, 'name': 'user_toggled' }, ], ) op.bulk_insert(tables.logentrykind, [ { 'name': 'toggle_repo_trigger' }, ]) op.add_column(u'repositorybuildtrigger', sa.Column('disabled_reason_id', sa.Integer(), nullable=True)) op.add_column( u'repositorybuildtrigger', sa.Column('enabled', sa.Boolean(), nullable=False, server_default=sa.sql.expression.true())) op.create_index('repositorybuildtrigger_disabled_reason_id', 'repositorybuildtrigger', ['disabled_reason_id'], unique=False) op.create_foreign_key( op.f('fk_repositorybuildtrigger_disabled_reason_id_disablereason'), 'repositorybuildtrigger', 'disablereason', ['disabled_reason_id'], ['id']) # ### end Alembic commands ### # ### population of test data ### # tester.populate_column('repositorybuildtrigger', 'disabled_reason_id', tester.TestDataType.Foreign('disablereason')) tester.populate_column('repositorybuildtrigger', 'enabled', tester.TestDataType.Boolean)
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) ### commands auto generated by Alembic - please adjust! ### op.create_table( "userpromptkind", sa.Column("id", sa.Integer(), nullable=False), sa.Column("name", sa.String(length=255), nullable=False), sa.PrimaryKeyConstraint("id", name=op.f("pk_userpromptkind")), ) op.create_index("userpromptkind_name", "userpromptkind", ["name"], unique=False) op.create_table( "userprompt", sa.Column("id", sa.Integer(), nullable=False), sa.Column("user_id", sa.Integer(), nullable=False), sa.Column("kind_id", sa.Integer(), nullable=False), sa.ForeignKeyConstraint( ["kind_id"], ["userpromptkind.id"], name=op.f("fk_userprompt_kind_id_userpromptkind")), sa.ForeignKeyConstraint(["user_id"], ["user.id"], name=op.f("fk_userprompt_user_id_user")), sa.PrimaryKeyConstraint("id", name=op.f("pk_userprompt")), ) op.create_index("userprompt_kind_id", "userprompt", ["kind_id"], unique=False) op.create_index("userprompt_user_id", "userprompt", ["user_id"], unique=False) op.create_index("userprompt_user_id_kind_id", "userprompt", ["user_id", "kind_id"], unique=True) ### end Alembic commands ### op.bulk_insert(tables.userpromptkind, [ { "name": "confirm_username" }, ]) # ### population of test data ### # tester.populate_table( "userprompt", [ ("user_id", tester.TestDataType.Foreign("user")), ("kind_id", tester.TestDataType.Foreign("userpromptkind")), ], )
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # ### commands auto generated by Alembic - please adjust! ### op.create_table( "logentry2", sa.Column("id", sa.Integer(), nullable=False), sa.Column("kind_id", sa.Integer(), nullable=False), sa.Column("account_id", sa.Integer(), nullable=False), sa.Column("performer_id", sa.Integer(), nullable=True), sa.Column("repository_id", sa.Integer(), nullable=True), sa.Column("datetime", sa.DateTime(), nullable=False), sa.Column("ip", sa.String(length=255), nullable=True), sa.Column("metadata_json", sa.Text(), nullable=False), sa.ForeignKeyConstraint( ["kind_id"], ["logentrykind.id"], name=op.f("fk_logentry2_kind_id_logentrykind")), sa.PrimaryKeyConstraint("id", name=op.f("pk_logentry2")), ) op.create_index("logentry2_account_id", "logentry2", ["account_id"], unique=False) op.create_index("logentry2_account_id_datetime", "logentry2", ["account_id", "datetime"], unique=False) op.create_index("logentry2_datetime", "logentry2", ["datetime"], unique=False) op.create_index("logentry2_kind_id", "logentry2", ["kind_id"], unique=False) op.create_index("logentry2_performer_id", "logentry2", ["performer_id"], unique=False) op.create_index("logentry2_performer_id_datetime", "logentry2", ["performer_id", "datetime"], unique=False) op.create_index("logentry2_repository_id", "logentry2", ["repository_id"], unique=False) op.create_index("logentry2_repository_id_datetime", "logentry2", ["repository_id", "datetime"], unique=False) op.create_index( "logentry2_repository_id_datetime_kind_id", "logentry2", ["repository_id", "datetime", "kind_id"], unique=False, )
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # ### commands auto generated by Alembic - please adjust! ### op.create_table( "namespacegeorestriction", sa.Column("id", sa.Integer(), nullable=False), sa.Column("namespace_id", sa.Integer(), nullable=False), sa.Column("added", sa.DateTime(), nullable=False), sa.Column("description", sa.String(length=255), nullable=False), sa.Column("unstructured_json", sa.Text(), nullable=False), sa.Column("restricted_region_iso_code", sa.String(length=255), nullable=False), sa.ForeignKeyConstraint( ["namespace_id"], ["user.id"], name=op.f("fk_namespacegeorestriction_namespace_id_user")), sa.PrimaryKeyConstraint("id", name=op.f("pk_namespacegeorestriction")), ) op.create_index( "namespacegeorestriction_namespace_id", "namespacegeorestriction", ["namespace_id"], unique=False, ) op.create_index( "namespacegeorestriction_namespace_id_restricted_region_iso_code", "namespacegeorestriction", ["namespace_id", "restricted_region_iso_code"], unique=True, ) op.create_index( "namespacegeorestriction_restricted_region_iso_code", "namespacegeorestriction", ["restricted_region_iso_code"], unique=False, ) # ### end Alembic commands ### tester.populate_table( "namespacegeorestriction", [ ("namespace_id", tester.TestDataType.Foreign("user")), ("added", tester.TestDataType.DateTime), ("description", tester.TestDataType.String), ("unstructured_json", tester.TestDataType.JSON), ("restricted_region_iso_code", tester.TestDataType.String), ], )
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # ### commands auto generated by Alembic - please adjust! ### op.create_table( "tagtorepositorytag", sa.Column("id", sa.Integer(), nullable=False), sa.Column("repository_id", sa.Integer(), nullable=False), sa.Column("tag_id", sa.Integer(), nullable=False), sa.Column("repository_tag_id", sa.Integer(), nullable=False), sa.ForeignKeyConstraint( ["repository_id"], ["repository.id"], name=op.f("fk_tagtorepositorytag_repository_id_repository"), ), sa.ForeignKeyConstraint( ["repository_tag_id"], ["repositorytag.id"], name=op.f("fk_tagtorepositorytag_repository_tag_id_repositorytag"), ), sa.ForeignKeyConstraint(["tag_id"], ["tag.id"], name=op.f("fk_tagtorepositorytag_tag_id_tag")), sa.PrimaryKeyConstraint("id", name=op.f("pk_tagtorepositorytag")), ) op.create_index("tagtorepositorytag_repository_id", "tagtorepositorytag", ["repository_id"], unique=False) op.create_index( "tagtorepositorytag_repository_tag_id", "tagtorepositorytag", ["repository_tag_id"], unique=True, ) op.create_index("tagtorepositorytag_tag_id", "tagtorepositorytag", ["tag_id"], unique=True) # ### end Alembic commands ### tester.populate_table( "tagtorepositorytag", [ ("repository_id", tester.TestDataType.Foreign("repository")), ("tag_id", tester.TestDataType.Foreign("tag")), ("repository_tag_id", tester.TestDataType.Foreign("repositorytag")), ], )
def downgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) op.drop_constraint(op.f('fk_repository_kind_id_repositorykind'), 'repository', type_='foreignkey') op.drop_index('repository_kind_id', table_name='repository') op.drop_column(u'repository', 'kind_id') op.drop_table('repositorykind')
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # Note: Because of a restriction in MySQL, we cannot simply remove the index and re-add # it without the unique=False, nor can we simply alter the index. To make it work, we'd have to # remove the primary key on the field, so instead we simply drop the table entirely and # recreate it with the modified index. The backfill will re-fill this in. op.drop_table("tagmanifesttomanifest") op.create_table( "tagmanifesttomanifest", sa.Column("id", sa.Integer(), nullable=False), sa.Column("tag_manifest_id", sa.Integer(), nullable=False), sa.Column("manifest_id", sa.Integer(), nullable=False), sa.Column("broken", sa.Boolean(), nullable=False, server_default=sa.sql.expression.false()), sa.ForeignKeyConstraint( ["manifest_id"], ["manifest.id"], name=op.f("fk_tagmanifesttomanifest_manifest_id_manifest"), ), sa.ForeignKeyConstraint( ["tag_manifest_id"], ["tagmanifest.id"], name=op.f("fk_tagmanifesttomanifest_tag_manifest_id_tagmanifest"), ), sa.PrimaryKeyConstraint("id", name=op.f("pk_tagmanifesttomanifest")), ) op.create_index( "tagmanifesttomanifest_broken", "tagmanifesttomanifest", ["broken"], unique=False ) op.create_index( "tagmanifesttomanifest_manifest_id", "tagmanifesttomanifest", ["manifest_id"], unique=False ) op.create_index( "tagmanifesttomanifest_tag_manifest_id", "tagmanifesttomanifest", ["tag_manifest_id"], unique=True, ) tester.populate_table( "tagmanifesttomanifest", [ ("manifest_id", tester.TestDataType.Foreign("manifest")), ("tag_manifest_id", tester.TestDataType.Foreign("tagmanifest")), ], )
def downgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) op.drop_constraint(op.f("fk_repository_kind_id_repositorykind"), "repository", type_="foreignkey") op.drop_index("repository_kind_id", table_name="repository") op.drop_column(u"repository", "kind_id") op.drop_table("repositorykind")
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # ### commands auto generated by Alembic - please adjust! ### op.create_table( "deletednamespace", sa.Column("id", sa.Integer(), nullable=False), sa.Column("namespace_id", sa.Integer(), nullable=False), sa.Column("marked", sa.DateTime(), nullable=False), sa.Column("original_username", sa.String(length=255), nullable=False), sa.Column("original_email", sa.String(length=255), nullable=False), sa.Column("queue_id", sa.String(length=255), nullable=True), sa.ForeignKeyConstraint( ["namespace_id"], ["user.id"], name=op.f("fk_deletednamespace_namespace_id_user")), sa.PrimaryKeyConstraint("id", name=op.f("pk_deletednamespace")), ) op.create_index("deletednamespace_namespace_id", "deletednamespace", ["namespace_id"], unique=True) op.create_index("deletednamespace_original_email", "deletednamespace", ["original_email"], unique=False) op.create_index( "deletednamespace_original_username", "deletednamespace", ["original_username"], unique=False, ) op.create_index("deletednamespace_queue_id", "deletednamespace", ["queue_id"], unique=False) # ### end Alembic commands ### # ### population of test data ### # tester.populate_table( "deletednamespace", [ ("namespace_id", tester.TestDataType.Foreign("user")), ("marked", tester.TestDataType.DateTime), ("original_username", tester.TestDataType.UTF8Char), ("original_email", tester.TestDataType.String), ("queue_id", tester.TestDataType.Foreign("queueitem")), ], )
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'logentry2', sa.Column('id', sa.Integer(), nullable=False), sa.Column('kind_id', sa.Integer(), nullable=False), sa.Column('account_id', sa.Integer(), nullable=False), sa.Column('performer_id', sa.Integer(), nullable=True), sa.Column('repository_id', sa.Integer(), nullable=True), sa.Column('datetime', sa.DateTime(), nullable=False), sa.Column('ip', sa.String(length=255), nullable=True), sa.Column('metadata_json', sa.Text(), nullable=False), sa.ForeignKeyConstraint( ['kind_id'], ['logentrykind.id'], name=op.f('fk_logentry2_kind_id_logentrykind')), sa.PrimaryKeyConstraint('id', name=op.f('pk_logentry2'))) op.create_index('logentry2_account_id', 'logentry2', ['account_id'], unique=False) op.create_index('logentry2_account_id_datetime', 'logentry2', ['account_id', 'datetime'], unique=False) op.create_index('logentry2_datetime', 'logentry2', ['datetime'], unique=False) op.create_index('logentry2_kind_id', 'logentry2', ['kind_id'], unique=False) op.create_index('logentry2_performer_id', 'logentry2', ['performer_id'], unique=False) op.create_index('logentry2_performer_id_datetime', 'logentry2', ['performer_id', 'datetime'], unique=False) op.create_index('logentry2_repository_id', 'logentry2', ['repository_id'], unique=False) op.create_index('logentry2_repository_id_datetime', 'logentry2', ['repository_id', 'datetime'], unique=False) op.create_index('logentry2_repository_id_datetime_kind_id', 'logentry2', ['repository_id', 'datetime', 'kind_id'], unique=False)
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) op.create_table( "repositorykind", sa.Column("id", sa.Integer(), nullable=False), sa.Column("name", sa.String(length=255), nullable=False), sa.PrimaryKeyConstraint("id", name=op.f("pk_repositorykind")), ) op.create_index("repositorykind_name", "repositorykind", ["name"], unique=True) op.bulk_insert( tables.repositorykind, [ { "id": 1, "name": "image" }, { "id": 2, "name": "application" }, ], ) op.add_column( u"repository", sa.Column("kind_id", sa.Integer(), nullable=False, server_default="1")) op.create_index("repository_kind_id", "repository", ["kind_id"], unique=False) op.create_foreign_key( op.f("fk_repository_kind_id_repositorykind"), "repository", "repositorykind", ["kind_id"], ["id"], ) # ### population of test data ### # tester.populate_column("repository", "kind_id", tester.TestDataType.Foreign("repositorykind"))
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) ### commands auto generated by Alembic - please adjust! ### op.create_table( 'userpromptkind', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=255), nullable=False), sa.PrimaryKeyConstraint('id', name=op.f('pk_userpromptkind'))) op.create_index('userpromptkind_name', 'userpromptkind', ['name'], unique=False) op.create_table( 'userprompt', sa.Column('id', sa.Integer(), nullable=False), sa.Column('user_id', sa.Integer(), nullable=False), sa.Column('kind_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint( ['kind_id'], ['userpromptkind.id'], name=op.f('fk_userprompt_kind_id_userpromptkind')), sa.ForeignKeyConstraint(['user_id'], ['user.id'], name=op.f('fk_userprompt_user_id_user')), sa.PrimaryKeyConstraint('id', name=op.f('pk_userprompt'))) op.create_index('userprompt_kind_id', 'userprompt', ['kind_id'], unique=False) op.create_index('userprompt_user_id', 'userprompt', ['user_id'], unique=False) op.create_index('userprompt_user_id_kind_id', 'userprompt', ['user_id', 'kind_id'], unique=True) ### end Alembic commands ### op.bulk_insert(tables.userpromptkind, [ { 'name': 'confirm_username' }, ]) # ### population of test data ### # tester.populate_table('userprompt', [ ('user_id', tester.TestDataType.Foreign('user')), ('kind_id', tester.TestDataType.Foreign('userpromptkind')), ])
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'namespacegeorestriction', sa.Column('id', sa.Integer(), nullable=False), sa.Column('namespace_id', sa.Integer(), nullable=False), sa.Column('added', sa.DateTime(), nullable=False), sa.Column('description', sa.String(length=255), nullable=False), sa.Column('unstructured_json', sa.Text(), nullable=False), sa.Column('restricted_region_iso_code', sa.String(length=255), nullable=False), sa.ForeignKeyConstraint( ['namespace_id'], ['user.id'], name=op.f('fk_namespacegeorestriction_namespace_id_user')), sa.PrimaryKeyConstraint('id', name=op.f('pk_namespacegeorestriction'))) op.create_index('namespacegeorestriction_namespace_id', 'namespacegeorestriction', ['namespace_id'], unique=False) op.create_index( 'namespacegeorestriction_namespace_id_restricted_region_iso_code', 'namespacegeorestriction', ['namespace_id', 'restricted_region_iso_code'], unique=True) op.create_index('namespacegeorestriction_restricted_region_iso_code', 'namespacegeorestriction', ['restricted_region_iso_code'], unique=False) # ### end Alembic commands ### tester.populate_table('namespacegeorestriction', [ ('namespace_id', tester.TestDataType.Foreign('user')), ('added', tester.TestDataType.DateTime), ('description', tester.TestDataType.String), ('unstructured_json', tester.TestDataType.JSON), ('restricted_region_iso_code', tester.TestDataType.String), ])
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # ### commands auto generated by Alembic - please adjust! ### op.add_column( "messages", sa.Column("media_type_id", sa.Integer(), nullable=False, server_default="1")) op.add_column( "messages", sa.Column("severity", sa.String(length=255), nullable=False, server_default="info"), ) op.alter_column( "messages", "uuid", existing_type=mysql.VARCHAR(length=36), server_default="", nullable=False, ) op.create_index("messages_media_type_id", "messages", ["media_type_id"], unique=False) op.create_index("messages_severity", "messages", ["severity"], unique=False) op.create_index("messages_uuid", "messages", ["uuid"], unique=False) op.create_foreign_key( op.f("fk_messages_media_type_id_mediatype"), "messages", "mediatype", ["media_type_id"], ["id"], ) # ### end Alembic commands ### op.bulk_insert(tables.mediatype, [ { "name": "text/markdown" }, ]) # ### population of test data ### # tester.populate_column("messages", "media_type_id", tester.TestDataType.Foreign("mediatype")) tester.populate_column("messages", "severity", lambda: "info") tester.populate_column("messages", "uuid", tester.TestDataType.UUID)
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'robotaccountmetadata', sa.Column('id', sa.Integer(), nullable=False), sa.Column('robot_account_id', sa.Integer(), nullable=False), sa.Column('description', UTF8CharField(length=255), nullable=False), sa.Column('unstructured_json', sa.Text(), nullable=False), sa.ForeignKeyConstraint( ['robot_account_id'], ['user.id'], name=op.f('fk_robotaccountmetadata_robot_account_id_user')), sa.PrimaryKeyConstraint('id', name=op.f('pk_robotaccountmetadata'))) op.create_index('robotaccountmetadata_robot_account_id', 'robotaccountmetadata', ['robot_account_id'], unique=True) # ### end Alembic commands ### # ### population of test data ### # tester.populate_table('robotaccountmetadata', [ ('robot_account_id', tester.TestDataType.Foreign('user')), ('description', tester.TestDataType.UTF8Char), ('unstructured_json', tester.TestDataType.JSON), ])
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) op.create_table( 'repositorykind', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=255), nullable=False), sa.PrimaryKeyConstraint('id', name=op.f('pk_repositorykind'))) op.create_index('repositorykind_name', 'repositorykind', ['name'], unique=True) op.bulk_insert( tables.repositorykind, [ { 'id': 1, 'name': 'image' }, { 'id': 2, 'name': 'application' }, ], ) op.add_column( u'repository', sa.Column('kind_id', sa.Integer(), nullable=False, server_default='1')) op.create_index('repository_kind_id', 'repository', ['kind_id'], unique=False) op.create_foreign_key(op.f('fk_repository_kind_id_repositorykind'), 'repository', 'repositorykind', ['kind_id'], ['id']) # ### population of test data ### # tester.populate_column('repository', 'kind_id', tester.TestDataType.Foreign('repositorykind'))
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # ### commands auto generated by Alembic - please adjust! ### op.create_table('appspecificauthtoken', sa.Column('id', sa.Integer(), nullable=False), sa.Column('user_id', sa.Integer(), nullable=False), sa.Column('uuid', sa.String(length=36), nullable=False), sa.Column('title', UTF8CharField(length=255), nullable=False), sa.Column('token_code', sa.String(length=255), nullable=False), sa.Column('created', sa.DateTime(), nullable=False), sa.Column('expiration', sa.DateTime(), nullable=True), sa.Column('last_accessed', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint(['user_id'], ['user.id'], name=op.f('fk_appspecificauthtoken_user_id_user')), sa.PrimaryKeyConstraint('id', name=op.f('pk_appspecificauthtoken')) ) op.create_index('appspecificauthtoken_token_code', 'appspecificauthtoken', ['token_code'], unique=True) op.create_index('appspecificauthtoken_user_id', 'appspecificauthtoken', ['user_id'], unique=False) op.create_index('appspecificauthtoken_user_id_expiration', 'appspecificauthtoken', ['user_id', 'expiration'], unique=False) op.create_index('appspecificauthtoken_uuid', 'appspecificauthtoken', ['uuid'], unique=False) # ### end Alembic commands ### op.bulk_insert(tables.logentrykind, [ {'name': 'create_app_specific_token'}, {'name': 'revoke_app_specific_token'}, ]) # ### population of test data ### # tester.populate_table('appspecificauthtoken', [ ('user_id', tester.TestDataType.Foreign('user')), ('uuid', tester.TestDataType.UUID), ('title', tester.TestDataType.UTF8Char), ('token_code', tester.TestDataType.String), ('created', tester.TestDataType.DateTime), ('expiration', tester.TestDataType.DateTime), ('last_accessed', tester.TestDataType.DateTime), ])
def upgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'deletednamespace', sa.Column('id', sa.Integer(), nullable=False), sa.Column('namespace_id', sa.Integer(), nullable=False), sa.Column('marked', sa.DateTime(), nullable=False), sa.Column('original_username', sa.String(length=255), nullable=False), sa.Column('original_email', sa.String(length=255), nullable=False), sa.Column('queue_id', sa.String(length=255), nullable=True), sa.ForeignKeyConstraint( ['namespace_id'], ['user.id'], name=op.f('fk_deletednamespace_namespace_id_user')), sa.PrimaryKeyConstraint('id', name=op.f('pk_deletednamespace'))) op.create_index('deletednamespace_namespace_id', 'deletednamespace', ['namespace_id'], unique=True) op.create_index('deletednamespace_original_email', 'deletednamespace', ['original_email'], unique=False) op.create_index('deletednamespace_original_username', 'deletednamespace', ['original_username'], unique=False) op.create_index('deletednamespace_queue_id', 'deletednamespace', ['queue_id'], unique=False) # ### end Alembic commands ### # ### population of test data ### # tester.populate_table('deletednamespace', [ ('namespace_id', tester.TestDataType.Foreign('user')), ('marked', tester.TestDataType.DateTime), ('original_username', tester.TestDataType.UTF8Char), ('original_email', tester.TestDataType.String), ('queue_id', tester.TestDataType.Foreign('queueitem')), ])
def downgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint( op.f('fk_repositorybuildtrigger_disabled_reason_id_disablereason'), 'repositorybuildtrigger', type_='foreignkey') op.drop_index('repositorybuildtrigger_disabled_reason_id', table_name='repositorybuildtrigger') op.drop_column(u'repositorybuildtrigger', 'enabled') op.drop_column(u'repositorybuildtrigger', 'disabled_reason_id') op.drop_table('disablereason') # ### end Alembic commands ### op.execute(tables.logentrykind.delete().where( tables.logentrykind.c.name == op.inline_literal( 'toggle_repo_trigger')))
def downgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint( op.f("fk_repositorybuildtrigger_disabled_reason_id_disablereason"), "repositorybuildtrigger", type_="foreignkey", ) op.drop_index("repositorybuildtrigger_disabled_reason_id", table_name="repositorybuildtrigger") op.drop_column(u"repositorybuildtrigger", "enabled") op.drop_column(u"repositorybuildtrigger", "disabled_reason_id") op.drop_table("disablereason") # ### end Alembic commands ### op.execute(tables.logentrykind.delete().where( tables.logentrykind.c.name == op.inline_literal( "toggle_repo_trigger")))
def downgrade(tables, tester, progress_reporter): op = ProgressWrapper(original_op, progress_reporter) # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(op.f('fk_messages_media_type_id_mediatype'), 'messages', type_='foreignkey') op.drop_index('messages_uuid', table_name='messages') op.drop_index('messages_severity', table_name='messages') op.drop_index('messages_media_type_id', table_name='messages') op.alter_column('messages', 'uuid', existing_type=mysql.VARCHAR(length=36), nullable=True) op.drop_column('messages', 'severity') op.drop_column('messages', 'media_type_id') # ### end Alembic commands ### op.execute(tables.mediatype.delete().where( tables.mediatype.c.name == op.inline_literal('text/markdown')))