# Path: gdcdatamodel/models/indexes.py
# def get_secondary_key_indexes(cls):
#     """Returns tuple of indexes on the secondary keys on the class
# 
#     ..note:: THIS MUST BE CALLED AFTER `cls_inject_secondary_keys()`
# 
#     - cls._props[key].astext
#     - lower(cls._props[key].astext)
# 
#     """
# 
#     #: use text_pattern_ops, allows LIKE statements not starting with %
#     index_op = 'text_pattern_ops'
#     secondary_keys = {key for pair in cls.__pg_secondary_keys for key in pair}
# 
#     key_indexes = (
#         Index(
#             index_name(cls, key),
#             cls._props[key].astext.label(key),
#             postgresql_ops={key: index_op},
#         ) for key in secondary_keys
#     )
# 
#     lower_key_indexes = (
#         Index(
#             index_name(cls, key+'_lower'),
#             func.lower(cls._props[key].astext).label(key+'_lower'),
#             postgresql_ops={key+'_lower': index_op},
#         ) for key in secondary_keys
#     )
# 
#     return tuple(key_indexes) + tuple(lower_key_indexes)
# 
# Path: gdcdatamodel/models/submission.py



from psqlgraph import Node
from gdcdatamodel.models import get_secondary_key_indexes
from gdcdatamodel.models.submission import TransactionLog
from sqlalchemy import Index
import logging
# -*- coding: utf-8 -*-
"""
migrations.async_transactions
----------------------------------

Migrates up/down between states A -> B
A: without
B: with
the following indexes per secondary key
- lower(_props ->> key)
- _props ->> key

"""




logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)


TX_LOG_PROJECT_ID_IDX = Index(
    'transaction_logs_project_id_idx',

# Path: gdcdatamodel/models/indexes.py
# def get_secondary_key_indexes(cls):
#     """Returns tuple of indexes on the secondary keys on the class
# 
#     ..note:: THIS MUST BE CALLED AFTER `cls_inject_secondary_keys()`
# 
#     - cls._props[key].astext
#     - lower(cls._props[key].astext)
# 
#     """
# 
#     #: use text_pattern_ops, allows LIKE statements not starting with %
#     index_op = 'text_pattern_ops'
#     secondary_keys = {key for pair in cls.__pg_secondary_keys for key in pair}
# 
#     key_indexes = (
#         Index(
#             index_name(cls, key),
#             cls._props[key].astext.label(key),
#             postgresql_ops={key: index_op},
#         ) for key in secondary_keys
#     )
# 
#     lower_key_indexes = (
#         Index(
#             index_name(cls, key+'_lower'),
#             func.lower(cls._props[key].astext).label(key+'_lower'),
#             postgresql_ops={key+'_lower': index_op},
#         ) for key in secondary_keys
#     )
# 
#     return tuple(key_indexes) + tuple(lower_key_indexes)
# 
# Path: gdcdatamodel/models/submission.py



# Path: migrations/index_secondary_keys.py
from psqlgraph import Node
from gdcdatamodel.models import get_secondary_key_indexes
from gdcdatamodel.models.submission import TransactionLog
from sqlalchemy import Index
import logging

# -*- coding: utf-8 -*-
"""
migrations.async_transactions
----------------------------------

Migrates up/down between states A -> B
A: without
B: with
the following indexes per secondary key
- lower(_props ->> key)
- _props ->> key

"""




logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)


TX_LOG_PROJECT_ID_IDX = Index(
    'transaction_logs_project_id_idx',

    TransactionLog.program+'_'+TransactionLog.project)