예제 #1
0
def schema(args: argparse.Namespace, auth: Sequence[str]) -> None:
    '''Prints the schema without modifying the usual database tables.

    This does touch the database, but is restricted to a dummy database
    `_omegaup_schema`.
    '''
    _SCHEMA_DB = '_omegaup_schema'
    args.databases = _SCHEMA_DB
    args.noop = False
    args.development_environment = False
    purge(args, auth)
    migrate(args, auth, update_metadata=False)
    # This is a false positive.
    # pylint: disable=no-member
    sys.stdout.buffer.write(
        database_utils.mysqldump(
            dbname=_SCHEMA_DB,
            auth=auth,
            container_check=not args.skip_container_check,
        ))
    database_utils.mysql(
        'DROP DATABASE `%s`;' % _SCHEMA_DB,
        auth=auth,
        container_check=not args.skip_container_check,
    )
예제 #2
0
파일: db-migrate.py 프로젝트: rcxr/omegaup
def schema(args, auth):
    '''Prints the schema without modifying the usual database tables.

    This does touch the database, but is restricted to a dummy database
    `_omegaup_schema`.
    '''
    _SCHEMA_DB = '_omegaup_schema'
    args.databases = _SCHEMA_DB
    args.noop = False
    args.development_environment = False
    purge(args, auth)
    migrate(args, auth, update_metadata=False)
    # This is a false positive.
    # pylint: disable=no-member
    sys.stdout.buffer.write(database_utils.mysqldump(dbname=_SCHEMA_DB,
                                                     auth=auth))
    database_utils.mysql('DROP DATABASE `%s`;' % _SCHEMA_DB, auth=auth)