# Path: models.py
# def tn(tablename):
#     """ shortcut to get tablename with prefix """
#     return '%s%s' % (TABLEPREFIX, tablename)


from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from migrate import *
from models import tn
# formats = Table(tn('format'), meta,
#                Column('id', Integer, primary_key=True),
#                Column('value', String(32), unique=True),
#                )

class Status(Base):
    __tablename__ = tn('status')

    id = Column(Integer, primary_key=True)
    value = Column(String(32), unique=True)

class Format(Base):
    __tablename__ = tn('formats')
    id = Column(Integer, primary_key=True)
    value = Column(String(32), nullable=False, unique=True)

class Tag(Base):
    __tablename__ = tn('tags')

    id = Column(Integer, primary_key=True)
    value = Column(String(64), nullable=False, unique=True)

class User(Base):
    __tablename__ = tn('users')

    id = Column(Integer, primary_key=True)
    username = Column(String(64), nullable=False, unique=True)
    password = Column(String(256), nullable=False)

class Post(Base):

# Path: models.py
# def tn(tablename):
#     """ shortcut to get tablename with prefix """
#     return '%s%s' % (TABLEPREFIX, tablename)


# Path: migrations/versions/001_Add_initial_tables.py
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from migrate import *
from models import tn

# formats = Table(tn('format'), meta,
#                Column('id', Integer, primary_key=True),
#                Column('value', String(32), unique=True),
#                )

class Status(Base):
    __tablename__ = tn('status')

    id = Column(Integer, primary_key=True)
    value = Column(String(32), unique=True)

class Format(Base):
    __tablename__ = tn('formats')
    id = Column(Integer, primary_key=True)
    value = Column(String(32), nullable=False, unique=True)

class Tag(Base):
    __tablename__ = tn('tags')

    id = Column(Integer, primary_key=True)
    value = Column(String(64), nullable=False, unique=True)

class User(Base):
    __tablename__ = tn('users')

    id = Column(Integer, primary_key=True)
    username = Column(String(64), nullable=False, unique=True)
    password = Column(String(256), nullable=False)

class Post(Base):

    __tablename__ = tn('posts')