Пример #1
0
    def __register__(cls, module_name):
        cursor = Transaction().cursor
        table = TableHandler(cursor, cls, module_name)

        if not table.column_exist('uuid'):
            table.add_raw_column('uuid',
                FIELDS[cls.uuid._type].sql_type(cls.uuid),
                FIELDS[cls.uuid._type].sql_format, None, None)
            cursor.execute('SELECT id FROM "' + cls._table + '"')
            for id, in cursor.fetchall():
                cursor.execute('UPDATE "' + cls._table + '" '
                    'SET "uuid" = %s WHERE id = %s',
                    (cls.default_uuid(), id))
        super(Party, cls).__register__(module_name)