2007-07-09 08:46:36 +02:00
|
|
|
from sqlalchemy import *
|
|
|
|
from migrate import *
|
|
|
|
from gnuviechadmin.backend.settings import dbschema
|
|
|
|
|
2008-04-04 20:36:46 +02:00
|
|
|
meta = MetaData(migrate_engine)
|
2007-07-09 08:46:36 +02:00
|
|
|
domain = Table('domain', meta, schema = dbschema, autoload = True)
|
|
|
|
mailaccount = Table(
|
|
|
|
'mailaccount', meta,
|
|
|
|
Column('mailaccountid', Integer, primary_key = True),
|
2008-04-04 20:36:46 +02:00
|
|
|
Column('domainid', Integer, ForeignKey(domain.c.domainid),
|
2007-07-09 08:46:36 +02:00
|
|
|
nullable = False),
|
|
|
|
Column('mailaccount', String(12), nullable = False, unique = True),
|
|
|
|
Column('clearpass', String(64)),
|
|
|
|
Column('cryptpass', String(34)),
|
|
|
|
Column('uid', Integer, nullable = False),
|
|
|
|
Column('gid', Integer, nullable = False),
|
|
|
|
Column('home', String(128), nullable = False),
|
|
|
|
Column('spamcheck', Boolean, nullable = False, default = False),
|
|
|
|
Column('sajunkscore', Integer),
|
2008-06-06 21:20:18 +02:00
|
|
|
schema = dbschema)
|
2007-07-09 08:46:36 +02:00
|
|
|
mailaddress = Table(
|
|
|
|
'mailaddress', meta,
|
|
|
|
Column('mailaddressid', Integer, primary_key = True),
|
2008-04-04 20:36:46 +02:00
|
|
|
Column('domainid', Integer, ForeignKey(domain.c.domainid),
|
2007-07-09 08:46:36 +02:00
|
|
|
nullable = False),
|
|
|
|
Column('email', String(255), nullable = False),
|
|
|
|
UniqueConstraint('email', 'domainid'),
|
2008-06-06 21:20:18 +02:00
|
|
|
schema = dbschema)
|
2007-07-09 08:46:36 +02:00
|
|
|
mailtarget = Table(
|
|
|
|
'mailtarget', meta,
|
|
|
|
Column('mailtargetid', Integer, primary_key = True),
|
2008-04-04 20:36:46 +02:00
|
|
|
Column('mailaddressid', Integer, ForeignKey(mailaddress.c.mailaddressid),
|
2007-07-09 08:46:36 +02:00
|
|
|
nullable = False),
|
|
|
|
Column('target', String(128), nullable = False),
|
|
|
|
UniqueConstraint('target', 'mailaddressid'),
|
2008-06-06 21:20:18 +02:00
|
|
|
schema = dbschema)
|
|
|
|
|
2007-07-09 08:46:36 +02:00
|
|
|
|
|
|
|
def upgrade():
|
|
|
|
mailaccount.create()
|
|
|
|
mailaddress.create()
|
|
|
|
mailtarget.create()
|
|
|
|
|
2008-06-06 21:20:18 +02:00
|
|
|
|
2007-07-09 08:46:36 +02:00
|
|
|
def downgrade():
|
|
|
|
mailtarget.drop()
|
|
|
|
mailaddress.drop()
|
|
|
|
mailaccount.drop()
|