Files
Chad Whitacre 28cb48c72a Big changeover from id to username; #287
I sort of did this one with the blast shield down. I haven't even run
the tests yet. The sorts of things I changed:

 - SQL {elsewhere,exchanges}.participant_id => .participant
 - SQL participants.id => .username
 - ORM {user,participant,self}.id => .username
2013-04-05 15:48:59 -04:00

17 lines
671 B
Python

from sqlalchemy.schema import Column, ForeignKey
from sqlalchemy.types import Integer, Numeric, Text, TIMESTAMP
from gittip.orm import db
class Exchange(db.Model):
__tablename__ = 'exchanges'
id = Column(Integer, nullable=False, primary_key=True)
timestamp = Column(TIMESTAMP(timezone=True), nullable=False,
default="now()")
amount = Column(Numeric(precision=35, scale=2), nullable=False)
fee = Column(Numeric(precision=35, scale=2), nullable=False)
participant = Column(Text, ForeignKey("participants.username",
onupdate="CASCADE", ondelete="RESTRICT"),
nullable=False)