Source

PyConference / pyconference / model / tables.py

Full commit
#coding:utf-8

import sqlalchemy as sa

from pyconference.model import meta

conferences = sa.Table('conferences', meta.metadata,
                             sa.Column('id', sa.types.Integer(), primary_key = True),
                             sa.Column('title', sa.types.Unicode(100), nullable = False),
                             sa.Column('description', sa.types.Unicode(), nullable = True),
                             sa.Column('start_date', sa.types.Date(), nullable = True),
                             sa.Column('end_date', sa.types.Date(), nullable = True)
                    )

presentation_types = sa.Table('presentation_types', meta.metadata,
                                   sa.Column('id', sa.types.Integer(), primary_key = True),
                                   sa.Column('name', sa.types.Unicode(255), nullable = False)
                    )

presentations = sa.Table('presentations', meta.metadata,
                             sa.Column('id', sa.types.Integer(), primary_key = True),
                             sa.Column('title', sa.types.UnicodeText(), nullable = False),
                             sa.Column('description', sa.types.UnicodeText(), nullable = True),
                             sa.Column('requirements', sa.types.UnicodeText(), nullable = True),
                             sa.Column('time', sa.types.DateTime(), nullable = True),
                             sa.Column('conference_id', sa.types.Integer(), nullable = False),
                             sa.Column('presentation_type_id', sa.types.Integer(), nullable = True),
                             sa.ForeignKeyConstraint(['conference_id', ], ['conferences.id', ]),
                             sa.ForeignKeyConstraint(['presentation_type_id', ], ['presentation_types.id', ])
                    )

authors = sa.Table('authors', meta.metadata,
                        sa.Column('id', sa.types.Integer(), primary_key = True),
                        sa.Column('title', sa.types.Unicode(100), nullable = True),
                        sa.Column('name', sa.types.Unicode(255), nullable = False),
                        sa.Column('abstract', sa.types.UnicodeText(), nullable = True),
                    )

author_presentation = sa.Table('autor_presentation', meta.metadata,
                                     sa.Column('author_id', sa.types.Integer(), primary_key = True),
                                     sa.Column('presentation_id', sa.types.Integer(), primary_key = True),
                                     sa.ForeignKeyConstraint(['author_id', ], ['authors.id', ]),
                                     sa.ForeignKeyConstraint(['presentation_id', ], ['presentations.id', ])
                    )

people = sa.Table('people', meta.metadata,
                        sa.Column('id', sa.types.Integer(), primary_key = True),
                        sa.Column('name', sa.types.Unicode(255), nullable = False),
                        sa.Column('email', sa.types.Unicode(255), nullable = False),
                        sa.Column('password', sa.types.Unicode(255), nullable = False),
                    )

subscriptions = sa.Table('subscriptions', meta.metadata,
                              sa.Column('id', sa.types.Integer(), primary_key = True),
                              sa.Column('subscription_date', sa.types.Date(), nullable = False),
                              sa.Column('person_id', sa.types.Integer(), nullable = False),
                              sa.Column('presentation_id', sa.types.Integer(), nullable = False),
                              sa.Column('status', sa.types.Boolean(), nullable = False, default = False),
                              sa.ForeignKeyConstraint(['person_id', ], ['people.id', ]),
                              sa.ForeignKeyConstraint(['presentation_id', ], ['presentations.id', ])
                    )