Source

trac-dvbcronrecording-plugin / src / dvbcronrecording / db / db1.py

# http://trac-hacks.org/wiki/TracSqlAlchemyBridgeIntegration

from sqlalchemy import (
    MetaData,
    # Boolean,
    Column,
    # DateTime,
    # ForeignKey,
    Integer,
    String,
    Table,
    # Unicode,
    PrimaryKeyConstraint,
    )
#from sqlalchemy.orm import relationship, backref
#from sqlalchemy.orm.exc import NoResultFound

metadata = MetaData()

tables = [ 
    Table('recording_list', metadata,
    Column('id', Integer, primary_key=True),
    Column('channelname', String),
    Column('newtime', String),
    Column('endtime', String),
    Column('extratime', String),
    Column('onlydate', String),
    Column('title', String),
    Column('status', String),
    Column('weekday', Integer),
    ),
    Table('recording_channels', metadata,
    Column('id', Integer, primary_key=True),
    Column('channelname', String),
    Column('adapter', String),
    Column('title', String),
    ),
    Table('recording_channelsconf', metadata,
    Column('adapter', String),
    Column('title', String),
    Column('frequency', Integer),
    Column('polarity', String),
    Column('source', String),
    Column('symbolrate', Integer),
    Column('vpid', Integer),
    Column('apid', Integer),
    Column('tpid', Integer),
    PrimaryKeyConstraint("adapter","title"),
    ),
    Table('recording_tuning', metadata,
    Column("id", Integer, primary_key=True),
    Column('adapter', String),
    Column('satellite', String),
    Column('transponder', String),
    Column('scansettings', String),
    Column('scansourcefile', String),
  ), 


]

from tsab2 import engine

def create_all(env, cursor):
    metadata.create_all(bind=engine(env))

def upgrade(env, cursor):
    pass
def downgrade(env, cursor):
    pass