Files
Chad Whitacre 1ae35fdb1f Greatly simplify schema for #449
I had originally thought we would have new tables for `companies` and
`brands` but we're going to use the existing `participants` table.
Instead, this adds a `type` column to `participants` which is an ENUM
with three values: individual, group, and open group. Individuals will
behave as participants currently do. Groups will say "We are" instead of
"I am" but will otherwise be the same. Open groups will be where we go
into all of the voting to decide how to split up the money.
2013-04-13 08:23:17 -04:00

26 lines
1.2 KiB
Python

from gittip.orm import db
from sqlalchemy.schema import Column, ForeignKey
from sqlalchemy.types import BigInteger, Numeric, Text, TIMESTAMP
class Identification(db.Model):
__tablename__ = 'identifications'
id = Column(BigInteger, nullable=False, primary_key=True)
ctime = Column(TIMESTAMP(timezone=True), nullable=False)
mtime = Column(TIMESTAMP(timezone=True), nullable=False, default="now()")
individual = Column(Text, ForeignKey( "participants.username"
, onupdate="CASCADE"
, ondelete="RESTRICT"
), nullable=False)
group = Column(Text, ForeignKey( "participants.username"
, onupdate="CASCADE"
, ondelete="RESTRICT"
), nullable=False)
weight = Column(Numeric(precision=17, scale=16), nullable=False)
identified_by = Column(Text, ForeignKey( "participants.username"
, onupdate="CASCADE"
, ondelete="RESTRICT"
), nullable=False)