def downgrade(tables, tester, progress_reporter):
    op = ProgressWrapper(original_op, progress_reporter)
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column(u'repositorybuildtrigger', 'secure_private_key')
    op.drop_column(u'repositorybuildtrigger', 'secure_auth_token')

    op.drop_index('oauthauthorizationcode_code',
                  table_name='oauthauthorizationcode')
    op.create_index('oauthauthorizationcode_code',
                    'oauthauthorizationcode', ['code'],
                    unique=False)
    op.drop_index('oauthauthorizationcode_code_name',
                  table_name='oauthauthorizationcode')
    op.drop_column(u'oauthauthorizationcode', 'code_name')
    op.drop_column(u'oauthauthorizationcode', 'code_credential')

    op.drop_column(u'oauthapplication', 'secure_client_secret')

    op.drop_index('oauthaccesstoken_token_name', table_name='oauthaccesstoken')
    op.drop_column(u'oauthaccesstoken', 'token_name')
    op.drop_column(u'oauthaccesstoken', 'token_code')

    op.drop_column(u'emailconfirmation', 'verification_code')

    op.drop_index('appspecificauthtoken_token_name',
                  table_name='appspecificauthtoken')
    op.drop_column(u'appspecificauthtoken', 'token_secret')
    op.drop_column(u'appspecificauthtoken', 'token_name')

    op.drop_index('accesstoken_token_name', table_name='accesstoken')
    op.drop_column(u'accesstoken', 'token_name')
    op.drop_column(u'accesstoken', 'token_code')

    op.drop_table('robotaccounttoken')
Esempio n. 2
0
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),
        ],
    )
Esempio n. 3
0
def downgrade(tables, tester, progress_reporter):
    op = ProgressWrapper(original_op, progress_reporter)
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column(u"repositorybuildtrigger", "secure_private_key")
    op.drop_column(u"repositorybuildtrigger", "secure_auth_token")

    op.drop_index("oauthauthorizationcode_code",
                  table_name="oauthauthorizationcode")
    op.create_index("oauthauthorizationcode_code",
                    "oauthauthorizationcode", ["code"],
                    unique=False)
    op.drop_index("oauthauthorizationcode_code_name",
                  table_name="oauthauthorizationcode")
    op.drop_column(u"oauthauthorizationcode", "code_name")
    op.drop_column(u"oauthauthorizationcode", "code_credential")

    op.drop_column(u"oauthapplication", "secure_client_secret")

    op.drop_index("oauthaccesstoken_token_name", table_name="oauthaccesstoken")
    op.drop_column(u"oauthaccesstoken", "token_name")
    op.drop_column(u"oauthaccesstoken", "token_code")

    op.drop_column(u"emailconfirmation", "verification_code")

    op.drop_index("appspecificauthtoken_token_name",
                  table_name="appspecificauthtoken")
    op.drop_column(u"appspecificauthtoken", "token_secret")
    op.drop_column(u"appspecificauthtoken", "token_name")

    op.drop_index("accesstoken_token_name", table_name="accesstoken")
    op.drop_column(u"accesstoken", "token_name")
    op.drop_column(u"accesstoken", "token_code")

    op.drop_table("robotaccounttoken")
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),
    ])
Esempio n. 5
0
def downgrade(tables, tester, progress_reporter):
    op = ProgressWrapper(original_op, progress_reporter)
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index("queueitem_state_id", table_name="queueitem")
    op.create_index("queueitem_state_id",
                    "queueitem", ["state_id"],
                    unique=False)
Esempio n. 6
0
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(
        "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)
Esempio n. 8
0
def upgrade(tables, tester, progress_reporter):
    op = ProgressWrapper(original_op, progress_reporter)
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('queueitem', sa.Column('state_id', sa.String(length=255), nullable=False, server_default=''))
    op.create_index('queueitem_state_id', 'queueitem', ['state_id'], unique=False)
    # ### end Alembic commands ###

    # ### population of test data ### #
    tester.populate_column('queueitem', 'state_id', 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("user", sa.Column("last_accessed", sa.DateTime(), nullable=True))
    op.create_index("user_last_accessed", "user", ["last_accessed"], unique=False)
    # ### end Alembic commands ###

    # ### population of test data ### #
    tester.populate_column("user", "last_accessed", tester.TestDataType.DateTime)
Esempio n. 10
0
def upgrade(tables, tester, progress_reporter):
    op = ProgressWrapper(original_op, progress_reporter)
    # Backfill the queueitem table's state_id field with unique values for all entries which are
    # empty.
    conn = op.get_bind()
    conn.execute("update queueitem set state_id = id where state_id = ''")

    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index("queueitem_state_id", table_name="queueitem")
    op.create_index("queueitem_state_id", "queueitem", ["state_id"], unique=True)
def downgrade(tables, tester, progress_reporter):
    op = ProgressWrapper(original_op, progress_reporter)
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'manifestblob',
        sa.Column('blob_index',
                  mysql.INTEGER(display_width=11),
                  autoincrement=False,
                  nullable=True))
    op.create_index('manifestblob_manifest_id_blob_index',
                    'manifestblob', ['manifest_id', 'blob_index'],
                    unique=True)
def upgrade(tables, tester, progress_reporter):
    op = ProgressWrapper(original_op, progress_reporter)
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('repositorybuildtrigger',
                  sa.Column('disabled_datetime', sa.DateTime(), nullable=True))
    op.create_index('repositorybuildtrigger_disabled_datetime',
                    'repositorybuildtrigger', ['disabled_datetime'],
                    unique=False)
    # ### end Alembic commands ###

    # ### population of test data ### #
    tester.populate_column('repositorybuildtrigger', 'disabled_datetime',
                           tester.TestDataType.DateTime)
Esempio n. 13
0
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_index(
        "repositorytag_repository_id_lifetime_end_ts",
        "repositorytag",
        ["repository_id", "lifetime_end_ts"],
        unique=False,
    )
    op.create_index(
        "tag_repository_id_lifetime_end_ms",
        "tag",
        ["repository_id", "lifetime_end_ms"],
        unique=False,
    )

    op.create_index(
        "repositorytag_repository_id_lifetime_start_ts",
        "repositorytag",
        ["repository_id", "lifetime_start_ts"],
        unique=False,
    )
    op.create_index(
        "tag_repository_id_lifetime_start_ms",
        "tag",
        ["repository_id", "lifetime_start_ms"],
        unique=False,
    )
Esempio n. 15
0
def upgrade(tables, tester, progress_reporter):
    op = ProgressWrapper(original_op, progress_reporter)
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "logentry3",
        sa.Column("id", sa.BigInteger(), 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.PrimaryKeyConstraint("id", name=op.f("pk_logentry3")),
    )
    op.create_index("logentry3_account_id_datetime",
                    "logentry3", ["account_id", "datetime"],
                    unique=False)
    op.create_index("logentry3_datetime",
                    "logentry3", ["datetime"],
                    unique=False)
    op.create_index("logentry3_performer_id_datetime",
                    "logentry3", ["performer_id", "datetime"],
                    unique=False)
    op.create_index(
        "logentry3_repository_id_datetime_kind_id",
        "logentry3",
        ["repository_id", "datetime", "kind_id"],
        unique=False,
    )
Esempio n. 16
0
def upgrade(tables, tester, progress_reporter):
    op = ProgressWrapper(original_op, progress_reporter)
    ### commands auto generated by Alembic - please adjust! ###
    op.create_index('queueitem_processing_expires_available',
                    'queueitem', ['processing_expires', 'available'],
                    unique=False)
    op.create_index('queueitem_pe_aafter_qname_rremaining_available',
                    'queueitem', [
                        'processing_expires', 'available_after', 'queue_name',
                        'retries_remaining', 'available'
                    ],
                    unique=False)
    op.create_index('queueitem_pexpires_aafter_rremaining_available',
                    'queueitem', [
                        'processing_expires', 'available_after',
                        'retries_remaining', 'available'
                    ],
                    unique=False)
    op.create_index('queueitem_processing_expires_queue_name_available',
                    'queueitem',
                    ['processing_expires', 'queue_name', 'available'],
                    unique=False)
    op.drop_index('queueitem_available', table_name='queueitem')
    op.drop_index('queueitem_available_after', table_name='queueitem')
    op.drop_index('queueitem_processing_expires', table_name='queueitem')
    op.drop_index('queueitem_retries_remaining', table_name='queueitem')
Esempio n. 17
0
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)
    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 downgrade(tables, tester, progress_reporter):
    op = ProgressWrapper(original_op, progress_reporter)
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        u'oauthaccesstoken',
        sa.Column('refresh_token', sa.String(length=255), nullable=True))
    op.create_index('oauthaccesstoken_refresh_token',
                    'oauthaccesstoken', ['refresh_token'],
                    unique=False)

    op.add_column(
        'repositorybuildtrigger',
        sa.Column('auth_token', sa.String(length=255), nullable=True))
    op.add_column('repositorybuildtrigger',
                  sa.Column('private_key', sa.Text(), nullable=True))

    op.add_column('oauthauthorizationcode',
                  sa.Column('code', sa.String(length=255), nullable=True))
    op.create_index('oauthauthorizationcode_code',
                    'oauthauthorizationcode', ['code'],
                    unique=True)

    op.add_column(
        'oauthapplication',
        sa.Column('client_secret', sa.String(length=255), nullable=True))
    op.add_column(
        'oauthaccesstoken',
        sa.Column('access_token', sa.String(length=255), nullable=True))

    op.create_index('oauthaccesstoken_access_token',
                    'oauthaccesstoken', ['access_token'],
                    unique=False)

    op.add_column(
        'appspecificauthtoken',
        sa.Column('token_code', sa.String(length=255), nullable=True))
    op.create_index('appspecificauthtoken_token_code',
                    'appspecificauthtoken', ['token_code'],
                    unique=True)

    op.add_column('accesstoken',
                  sa.Column('code', sa.String(length=255), nullable=True))
    op.create_index('accesstoken_code', 'accesstoken', ['code'], unique=True)
def downgrade(tables, tester, progress_reporter):
    op = ProgressWrapper(original_op, progress_reporter)
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        u"oauthaccesstoken",
        sa.Column("refresh_token", sa.String(length=255), nullable=True))
    op.create_index("oauthaccesstoken_refresh_token",
                    "oauthaccesstoken", ["refresh_token"],
                    unique=False)

    op.add_column(
        "repositorybuildtrigger",
        sa.Column("auth_token", sa.String(length=255), nullable=True))
    op.add_column("repositorybuildtrigger",
                  sa.Column("private_key", sa.Text(), nullable=True))

    op.add_column("oauthauthorizationcode",
                  sa.Column("code", sa.String(length=255), nullable=True))
    op.create_index("oauthauthorizationcode_code",
                    "oauthauthorizationcode", ["code"],
                    unique=True)

    op.add_column(
        "oauthapplication",
        sa.Column("client_secret", sa.String(length=255), nullable=True))
    op.add_column(
        "oauthaccesstoken",
        sa.Column("access_token", sa.String(length=255), nullable=True))

    op.create_index("oauthaccesstoken_access_token",
                    "oauthaccesstoken", ["access_token"],
                    unique=False)

    op.add_column(
        "appspecificauthtoken",
        sa.Column("token_code", sa.String(length=255), nullable=True))
    op.create_index("appspecificauthtoken_token_code",
                    "appspecificauthtoken", ["token_code"],
                    unique=True)

    op.add_column("accesstoken",
                  sa.Column("code", sa.String(length=255), nullable=True))
    op.create_index("accesstoken_code", "accesstoken", ["code"], unique=True)
Esempio n. 21
0
def upgrade(tables, tester, progress_reporter):
    op = ProgressWrapper(original_op, progress_reporter)
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_index(
        "repository_description__fulltext",
        "repository",
        ["description"],
        unique=False,
        postgresql_using="gin",
        postgresql_ops={"description": "gin_trgm_ops"},
        mysql_prefix="FULLTEXT",
    )
    op.create_index(
        "repository_name__fulltext",
        "repository",
        ["name"],
        unique=False,
        postgresql_using="gin",
        postgresql_ops={"name": "gin_trgm_ops"},
        mysql_prefix="FULLTEXT",
    )
Esempio n. 22
0
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(
        '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)
Esempio n. 25
0
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(
        "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(
        '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_index("permissionprototype_uuid",
                    "permissionprototype", ["uuid"],
                    unique=False)
    op.create_index("repositorybuildtrigger_uuid",
                    "repositorybuildtrigger", ["uuid"],
                    unique=False)
    op.create_index("user_uuid", "user", ["uuid"], unique=False)
def upgrade(tables, tester, progress_reporter):
    op = ProgressWrapper(original_op, progress_reporter)
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('logentry3',
    sa.Column('id', sa.BigInteger(), 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.PrimaryKeyConstraint('id', name=op.f('pk_logentry3'))
    )
    op.create_index('logentry3_account_id_datetime', 'logentry3', ['account_id', 'datetime'], unique=False)
    op.create_index('logentry3_datetime', 'logentry3', ['datetime'], unique=False)
    op.create_index('logentry3_performer_id_datetime', 'logentry3', ['performer_id', 'datetime'], unique=False)
    op.create_index('logentry3_repository_id_datetime_kind_id', 'logentry3', ['repository_id', 'datetime', 'kind_id'], unique=False)