# Path: src/main.py
# def on_shutdown():
# 
# Path: src/logcfg.py
# DEBUG_TEMPL = '  %(levelname)-7.7s %(funcName)s: %(message)s'
# PROD_TEMPL  = '%(asctime)s %(levelname)-7.7s %(funcName)s: %(message)s'
# DEBUG = logging.DEBUG
# class ColorFmtr(Formatter):
#     def __init__(self, *args, **kwargs):
#     def format(self, record):
# def makefunc(level):
#         def tb_func(msg, *args, **kwargs):
#     def thefunc(msg, *args, **kwargs):


from flask_security import UserMixin, RoleMixin
from flask_security.utils import encrypt_password, verify_password
from sqlalchemy import (
    Boolean,
    Column,
    DateTime,
    ForeignKey,
    Integer,
    String,
    Table,
    Text,
)
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy_utils import IPAddressType, TimezoneType
from . import config
from .main import app, db
from .logcfg import log
    from datetime import datetime as dt
    from sqlalchemy.exc import IntegrityError, InvalidRequestError
    import inspect
'''
    Core database models and tools are contained here.
'''



class BaseMixin:
    ''' This parent model mixin contains common fields. '''
    id = Column(Integer, index=True, unique=True, primary_key=True)
    name = Column(String(127), index=True, nullable=False)
    desc = Column(Text(255), default='')
    # now() updated to current_timestamp:
    # https://groups.google.com/forum/#!topic/sqlalchemy/7A6LCOKnrVY

# Path: src/main.py
# def on_shutdown():
# 
# Path: src/logcfg.py
# DEBUG_TEMPL = '  %(levelname)-7.7s %(funcName)s: %(message)s'
# PROD_TEMPL  = '%(asctime)s %(levelname)-7.7s %(funcName)s: %(message)s'
# DEBUG = logging.DEBUG
# class ColorFmtr(Formatter):
#     def __init__(self, *args, **kwargs):
#     def format(self, record):
# def makefunc(level):
#         def tb_func(msg, *args, **kwargs):
#     def thefunc(msg, *args, **kwargs):


# Path: src/models.py
from flask_security import UserMixin, RoleMixin
from flask_security.utils import encrypt_password, verify_password
from sqlalchemy import (
    Boolean,
    Column,
    DateTime,
    ForeignKey,
    Integer,
    String,
    Table,
    Text,
)
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy_utils import IPAddressType, TimezoneType
from . import config
from .main import app, db
from .logcfg import log
    from datetime import datetime as dt
    from sqlalchemy.exc import IntegrityError, InvalidRequestError
    import inspect

'''
    Core database models and tools are contained here.
'''



class BaseMixin:
    ''' This parent model mixin contains common fields. '''
    id = Column(Integer, index=True, unique=True, primary_key=True)
    name = Column(String(127), index=True, nullable=False)
    desc = Column(Text(255), default='')
    # now() updated to current_timestamp:
    # https://groups.google.com/forum/#!topic/sqlalchemy/7A6LCOKnrVY

    created_at = Column(DateTime, server_default=db.func.current_timestamp())