# Path: raggregate/guid_recipe.py
# class GUID(TypeDecorator):
#     """Platform-independent GUID type.
# 
#     Uses Postgresql's UUID type, otherwise uses
#     CHAR(32), storing as stringified hex values.
# 
#     """
#     impl = CHAR
# 
#     def load_dialect_impl(self, dialect):
#         if dialect.name == 'postgresql':
#             return dialect.type_descriptor(UUID())
#         else:
#             return dialect.type_descriptor(CHAR(32))
# 
#     def process_bind_param(self, value, dialect):
#         if value is None:
#             return value
#         elif dialect.name == 'postgresql':
#             return str(value)
#         else:
#             if not isinstance(value, uuid.UUID):
#                 return "{0}".format(uuid.UUID(value))
#             else:
#                 # hexstring
#                 return "{0}".format(value)
# 
#     def process_result_value(self, value, dialect):
#         if value is None:
#             return value
#         else:
#             return uuid.UUID(value)


from sqlalchemy import *
from migrate import *
from raggregate.guid_recipe import GUID


meta = MetaData()

def make_subscriptions_table(meta):
    users = Table('users', meta, autoload=True)
    sections = Table('sections', meta, autoload=True)

    users_subscriptions = Table(
        'users_subscriptions', meta,

# Path: raggregate/guid_recipe.py
# class GUID(TypeDecorator):
#     """Platform-independent GUID type.
# 
#     Uses Postgresql's UUID type, otherwise uses
#     CHAR(32), storing as stringified hex values.
# 
#     """
#     impl = CHAR
# 
#     def load_dialect_impl(self, dialect):
#         if dialect.name == 'postgresql':
#             return dialect.type_descriptor(UUID())
#         else:
#             return dialect.type_descriptor(CHAR(32))
# 
#     def process_bind_param(self, value, dialect):
#         if value is None:
#             return value
#         elif dialect.name == 'postgresql':
#             return str(value)
#         else:
#             if not isinstance(value, uuid.UUID):
#                 return "{0}".format(uuid.UUID(value))
#             else:
#                 # hexstring
#                 return "{0}".format(value)
# 
#     def process_result_value(self, value, dialect):
#         if value is None:
#             return value
#         else:
#             return uuid.UUID(value)


# Path: raggregate/rg_migrations/versions/006_Add_subscriptions.py
from sqlalchemy import *
from migrate import *
from raggregate.guid_recipe import GUID



meta = MetaData()

def make_subscriptions_table(meta):
    users = Table('users', meta, autoload=True)
    sections = Table('sections', meta, autoload=True)

    users_subscriptions = Table(
        'users_subscriptions', meta,

        Column('id', GUID, primary_key=True),