xpgdiff.py
def print_dropadd_migration_ddl(source_objs, target_objs):
    """
    Prints migration DDL for objects that are always drop or add.
    The class for the objects must have a name field; addstr and dropstr
    methods; and a meaningful implementation of __eq__.

    The passed sequences must already be sorted by name.

    :param source_objs: The objects in the source schema.
    :param target_objs: The objects in the target schema.
    """

    next_source_obj = next_or_none(source_objs)
    next_target_obj = next_or_none(target_objs)

    source_obj = next_source_obj()
    target_obj = next_target_obj()

    while source_obj or target_obj:
        if not target_obj:
            print(source_obj.dropstr())
            source_obj = next_source_obj()
            continue

        if not source_obj:
            print(target_obj.addstr())
            target_obj = next_target_obj()
            continue

        if source_obj.name < target_obj.name:
            print(source_obj.dropstr())
            source_obj = next_source_obj()
            continue

        if source_obj.name > target_obj.name:
            print(target_obj.addstr())
            target_obj = next_target_obj()
            continue

        if source_obj != target_obj:
            print('Yes')
            print(source_obj.dropstr())
            print(target_obj.addstr())

        source_obj = next_source_obj()
        target_obj = next_target_obj()

    Prints migration DDL for objects that are always drop or add.
    The class for the objects must have a name field; addstr and dropstr
    methods; and a meaningful implementation of __eq__.

    The passed sequences must already be sorted by name.

    :param source_objs: The objects in the source schema.
    :param target_objs: The objects in the target schema.
    
Prints migration DDL for objects that are always drop or add.
The class for the objects must have a name field; addstr and dropstr
methods; and a meaningful implementation of __eq__.

The passed sequences must already be sorted by name.
Prints migration DDL for objects that are always drop or add . The class for the objects must have a name field ; addstr and dropstr methods ; and a meaningful implementation of __eq__ . The passed sequences must already be sorted by name .
def print_dropadd_migration_ddl(source_objs, target_objs):
    next_source_obj = next_or_none(source_objs)
    next_target_obj = next_or_none(target_objs)
    source_obj = next_source_obj()
    target_obj = next_target_obj()
    while source_obj or target_obj:
        if not target_obj:
            print(source_obj.dropstr())
            source_obj = next_source_obj()
            continue
        if not source_obj:
            print(target_obj.addstr())
            target_obj = next_target_obj()
            continue
        if source_obj.name < target_obj.name:
            print(source_obj.dropstr())
            source_obj = next_source_obj()
            continue
        if source_obj.name > target_obj.name:
            print(target_obj.addstr())
            target_obj = next_target_obj()
            continue
        if source_obj != target_obj:
            print('Yes')
            print(source_obj.dropstr())
            print(target_obj.addstr())
        source_obj = next_source_obj()
        target_obj = next_target_obj()
def print_dropadd_migration_ddl ( source_objs , target_objs ) : next_source_obj = next_or_none ( source_objs ) next_target_obj = next_or_none ( target_objs ) source_obj = next_source_obj ( ) target_obj = next_target_obj ( ) while source_obj or target_obj : if not target_obj : print ( source_obj . dropstr ( ) ) source_obj = next_source_obj ( ) continue if not source_obj : print ( target_obj . addstr ( ) ) target_obj = next_target_obj ( ) continue if source_obj . name < target_obj . name : print ( source_obj . dropstr ( ) ) source_obj = next_source_obj ( ) continue if source_obj . name > target_obj . name : print ( target_obj . addstr ( ) ) target_obj = next_target_obj ( ) continue if source_obj != target_obj : print ( 'Yes' ) print ( source_obj . dropstr ( ) ) print ( target_obj . addstr ( ) ) source_obj = next_source_obj ( ) target_obj = next_target_obj ( )
Prints migration DDL for objects that are always drop or add.
Prints migration DDL for objects that are always drop or add .
"""
    Prints migration DDL for objects that are always drop or add.
    The class for the objects must have a name field; addstr and dropstr
    methods; and a meaningful implementation of __eq__.

    The passed sequences must already be sorted by name.

    :param source_objs: The objects in the source schema.
    :param target_objs: The objects in the target schema.
    """
source_objs
The objects in the source schema.
The objects in the source schema .
target_objs
The objects in the target schema.
The objects in the target schema .