# Path: ngcrowd/models.py
# class JsonifyMixin:
# class Application(Base, JsonifyMixin):
# class User(Base):
# class Entity(Base, JsonifyMixin):
# class EntityProperty(Base, JsonifyMixin):
# class EntityPropertyValue(Base):
# class ReferenceBookValue(Base):
# class EntityVersions(Base):
#     def __init__(self):
#     def as_json_dict(self, **init):
#     def password_hash(cls, password, salt):
#     def as_dict(self, **addon):
#     def to_dict(self):
#     def to_json_binary_dump(self, json_object):


import os
import sys
import transaction
from sqlalchemy import engine_from_config
from pyramid.paster import (
    get_appsettings,
    setup_logging,
    )
from ..models import (
    DBSession,
    Base,
    )





def usage(argv):
    cmd = os.path.basename(argv[0])
    print('usage: %s <config_uri>\n'
          '(example: "%s development.ini")' % (cmd, cmd))
    sys.exit(1)


def main(argv=sys.argv):
    if len(argv) != 2:
        usage(argv)
    config_uri = argv[1]
    setup_logging(config_uri)
    settings = get_appsettings(config_uri)
    engine = engine_from_config(settings, 'sqlalchemy.')
    DBSession.configure(bind=engine)
    Base.metadata.drop_all(engine)

# Path: ngcrowd/models.py
# class JsonifyMixin:
# class Application(Base, JsonifyMixin):
# class User(Base):
# class Entity(Base, JsonifyMixin):
# class EntityProperty(Base, JsonifyMixin):
# class EntityPropertyValue(Base):
# class ReferenceBookValue(Base):
# class EntityVersions(Base):
#     def __init__(self):
#     def as_json_dict(self, **init):
#     def password_hash(cls, password, salt):
#     def as_dict(self, **addon):
#     def to_dict(self):
#     def to_json_binary_dump(self, json_object):


# Path: ngcrowd/scripts/initializedb.py
import os
import sys
import transaction
from sqlalchemy import engine_from_config
from pyramid.paster import (
    get_appsettings,
    setup_logging,
    )
from ..models import (
    DBSession,
    Base,
    )






def usage(argv):
    cmd = os.path.basename(argv[0])
    print('usage: %s <config_uri>\n'
          '(example: "%s development.ini")' % (cmd, cmd))
    sys.exit(1)


def main(argv=sys.argv):
    if len(argv) != 2:
        usage(argv)
    config_uri = argv[1]
    setup_logging(config_uri)
    settings = get_appsettings(config_uri)
    engine = engine_from_config(settings, 'sqlalchemy.')
    DBSession.configure(bind=engine)
    Base.metadata.drop_all(engine)

    Base.metadata.create_all(engine)