old gnuviechadmin version that is not developed anymore
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

49 lines
1.6 KiB

from sqlalchemy import *
from migrate import *
from gnuviechadmin.backend.settings import dbschema
meta = MetaData(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.c.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.c.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.c.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()