1
0
Fork 0
gnuviechadmin-historic/data/dbrepo/versions/3/3.py
Jan Dittberner fdea3217c8 - mail related tables in database schema
- gpg encryption for mails
- domain creation and deletion completed
- logging
- use pwd and grp


git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@230 a67ec6bc-e5d5-0310-a910-815c51eb3124
2007-07-09 06:46:36 +00:00

49 lines
1.6 KiB
Python

from sqlalchemy import *
from migrate import *
from gnuviechadmin.backend.settings import dbschema
meta = BoundMetaData(migrate_engine)
domain = Table('domain', meta, schema = dbschema, autoload = True)
mailaccount = Table(
'mailaccount', meta,
Column('mailaccountid', Integer, primary_key = True),
Column('domainid', Integer, ForeignKey('domain.domainid'),
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),
schema = dbschema
)
mailaddress = Table(
'mailaddress', meta,
Column('mailaddressid', Integer, primary_key = True),
Column('domainid', Integer, ForeignKey('domain.domainid'),
nullable = False),
Column('email', String(255), nullable = False),
UniqueConstraint('email', 'domainid'),
schema = dbschema
)
mailtarget = Table(
'mailtarget', meta,
Column('mailtargetid', Integer, primary_key = True),
Column('mailaddressid', Integer, ForeignKey('mailaddress.mailaddressid'),
nullable = False),
Column('target', String(128), nullable = False),
UniqueConstraint('target', 'mailaddressid'),
schema = dbschema
)
def upgrade():
mailaccount.create()
mailaddress.create()
mailtarget.create()
def downgrade():
mailtarget.drop()
mailaddress.drop()
mailaccount.drop()