xpgdiff.py
def print_tables_migration_ddl(source_schema, target_schema):
    """
    Prints DDL to migrate the tables in two schemas.

    :param source_schema: The source schema.
    :param target_schema: The target schema.
    """
    print('--')
    print('-- TABLES')
    print('--')
    next_source_table = next_or_none(source_schema.tables)
    next_target_table = next_or_none(target_schema.tables)

    source_table = next_source_table()
    target_table = next_target_table()

    while source_table or target_table:
        if not target_table:
            print(source_table.dropstr())
            source_table = next_source_table()
            continue

        if not source_table:
            print(f'{str(target_table)}')
            target_table = next_target_table()
            continue

        if source_table.name < target_table.name:
            print(source_table.dropstr())
            source_table = next_source_table()
            continue

        if source_table.name > target_table.name:
            print(f'{str(target_table)}')
            target_table = next_target_table()
            continue

        print_table_migration_ddl(source_table, target_table)
        source_table = next_source_table()
        target_table = next_target_table()

    Prints DDL to migrate the tables in two schemas.

    :param source_schema: The source schema.
    :param target_schema: The target schema.
    
Prints DDL to migrate the tables in two schemas.
Prints DDL to migrate the tables in two schemas .
def print_tables_migration_ddl(source_schema, target_schema):
    print('--')
    print('-- TABLES')
    print('--')
    next_source_table = next_or_none(source_schema.tables)
    next_target_table = next_or_none(target_schema.tables)
    source_table = next_source_table()
    target_table = next_target_table()
    while source_table or target_table:
        if not target_table:
            print(source_table.dropstr())
            source_table = next_source_table()
            continue
        if not source_table:
            print(f'{str(target_table)}')
            target_table = next_target_table()
            continue
        if source_table.name < target_table.name:
            print(source_table.dropstr())
            source_table = next_source_table()
            continue
        if source_table.name > target_table.name:
            print(f'{str(target_table)}')
            target_table = next_target_table()
            continue
        print_table_migration_ddl(source_table, target_table)
        source_table = next_source_table()
        target_table = next_target_table()
def print_tables_migration_ddl ( source_schema , target_schema ) : print ( '--' ) print ( '-- TABLES' ) print ( '--' ) next_source_table = next_or_none ( source_schema . tables ) next_target_table = next_or_none ( target_schema . tables ) source_table = next_source_table ( ) target_table = next_target_table ( ) while source_table or target_table : if not target_table : print ( source_table . dropstr ( ) ) source_table = next_source_table ( ) continue if not source_table : print ( f'{str(target_table)}' ) target_table = next_target_table ( ) continue if source_table . name < target_table . name : print ( source_table . dropstr ( ) ) source_table = next_source_table ( ) continue if source_table . name > target_table . name : print ( f'{str(target_table)}' ) target_table = next_target_table ( ) continue print_table_migration_ddl ( source_table , target_table ) source_table = next_source_table ( ) target_table = next_target_table ( )
Prints DDL to migrate the tables in two schemas.
Prints DDL to migrate the tables in two schemas .
"""
    Prints DDL to migrate the tables in two schemas.

    :param source_schema: The source schema.
    :param target_schema: The target schema.
    """
source_schema
The source schema.
The source schema .
target_schema
The target schema.
The target schema .