xpgdiff.py
def print_schemas_migration_ddl(source_schemas, target_schemas):
    """
    Prints the migration DDL for two lists of schemas.  The DDL will migrate
    a database with the source schemas to one with the target schemas.

    :param source_schemas: The source schemas.
    :param target_schemas: The target schemas.
    """
    next_source_schema = next_or_none(sorted(source_schemas, key=lambda f: f.name))
    next_target_schema = next_or_none(sorted(target_schemas, key=lambda f: f.name))

    source_schema = next_source_schema()
    target_schema = next_target_schema()

    while source_schema or target_schema:
        if not target_schema:
            print_schema_banner(source_schema)
            print(source_schema.dropstr())
            source_schema = next_source_schema()
            continue

        if not source_schema:
            print_schema_banner(target_schema)
            print(target_schema.addstr())
            print_schema_ddl(target_schema)
            target_schema = next_target_schema()
            continue

        if source_schema.name < target_schema.name:
            print_schema_banner(source_schema)
            print(source_schema.dropstr())
            source_schema = next_source_schema()
            continue

        if source_schema.name > target_schema.name:
            print_schema_banner(target_schema)
            print(target_schema.addstr())
            print_schema_ddl(target_schema)
            target_schema = next_target_schema()
            continue

        print_schema_migration_ddl(source_schema, target_schema)

        source_schema = next_source_schema()
        target_schema = next_target_schema()

    Prints the migration DDL for two lists of schemas.  The DDL will migrate
    a database with the source schemas to one with the target schemas.

    :param source_schemas: The source schemas.
    :param target_schemas: The target schemas.
    
Prints the migration DDL for two lists of schemas.  The DDL will migrate
a database with the source schemas to one with the target schemas.
Prints the migration DDL for two lists of schemas . The DDL will migrate a database with the source schemas to one with the target schemas .
def print_schemas_migration_ddl(source_schemas, target_schemas):
    next_source_schema = next_or_none(sorted(source_schemas, key=lambda f: f.name))
    next_target_schema = next_or_none(sorted(target_schemas, key=lambda f: f.name))
    source_schema = next_source_schema()
    target_schema = next_target_schema()
    while source_schema or target_schema:
        if not target_schema:
            print_schema_banner(source_schema)
            print(source_schema.dropstr())
            source_schema = next_source_schema()
            continue
        if not source_schema:
            print_schema_banner(target_schema)
            print(target_schema.addstr())
            print_schema_ddl(target_schema)
            target_schema = next_target_schema()
            continue
        if source_schema.name < target_schema.name:
            print_schema_banner(source_schema)
            print(source_schema.dropstr())
            source_schema = next_source_schema()
            continue
        if source_schema.name > target_schema.name:
            print_schema_banner(target_schema)
            print(target_schema.addstr())
            print_schema_ddl(target_schema)
            target_schema = next_target_schema()
            continue
        print_schema_migration_ddl(source_schema, target_schema)
        source_schema = next_source_schema()
        target_schema = next_target_schema()
def print_schemas_migration_ddl ( source_schemas , target_schemas ) : next_source_schema = next_or_none ( sorted ( source_schemas , key = lambda f : f . name ) ) next_target_schema = next_or_none ( sorted ( target_schemas , key = lambda f : f . name ) ) source_schema = next_source_schema ( ) target_schema = next_target_schema ( ) while source_schema or target_schema : if not target_schema : print_schema_banner ( source_schema ) print ( source_schema . dropstr ( ) ) source_schema = next_source_schema ( ) continue if not source_schema : print_schema_banner ( target_schema ) print ( target_schema . addstr ( ) ) print_schema_ddl ( target_schema ) target_schema = next_target_schema ( ) continue if source_schema . name < target_schema . name : print_schema_banner ( source_schema ) print ( source_schema . dropstr ( ) ) source_schema = next_source_schema ( ) continue if source_schema . name > target_schema . name : print_schema_banner ( target_schema ) print ( target_schema . addstr ( ) ) print_schema_ddl ( target_schema ) target_schema = next_target_schema ( ) continue print_schema_migration_ddl ( source_schema , target_schema ) source_schema = next_source_schema ( ) target_schema = next_target_schema ( )
Prints the migration DDL for two lists of schemas.
Prints the migration DDL for two lists of schemas .
"""
    Prints the migration DDL for two lists of schemas.  The DDL will migrate
    a database with the source schemas to one with the target schemas.

    :param source_schemas: The source schemas.
    :param target_schemas: The target schemas.
    """
source_schemas
The source schemas.
The source schemas .
target_schemas
The target schemas.
The target schemas .