1
0
Fork 0

- repository reorganization

git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/trunk@242 a67ec6bc-e5d5-0310-a910-815c51eb3124
This commit is contained in:
Jan Dittberner 2008-01-12 22:24:08 +00:00
parent 5c1a97e82d
commit dea15a6c4f
29 changed files with 1053 additions and 0 deletions

View file

@ -0,0 +1,4 @@
This is a database migration repository.
More information at
http://trac.erosson.com/migrate

View file

@ -0,0 +1,4 @@
#!/usr/bin/python
from migrate.versioning.shell import main
main(repository='gnuviechadmin')

View file

@ -0,0 +1,20 @@
[db_settings]
# Used to identify which repository this database is versioned under.
# You can use the name of your project.
repository_id=GNUViech Admin
# The name of the database table used to track the schema version.
# This name shouldn't already be used by your project.
# If this is changed once a database is under version control, you'll need to
# change the table name in each database too.
version_table=migrate_version
# When committing a change script, Migrate will attempt to generate the
# sql for all supported databases; normally, if one of them fails - probably
# because you don't have that database installed - it is ignored and the
# commit continues, perhaps ending successfully.
# Databases in this list MUST compile successfully during a commit, or the
# entire commit will fail. List the databases your application will actually
# be using to ensure your updates to that database work properly.
# This must be a list; example: ['postgres','sqlite']
required_dbs=[]

View file

@ -0,0 +1,33 @@
# setup tables for spamassassin
from sqlalchemy import *
from migrate import *
meta = BoundMetaData(migrate_engine)
domains = Table('domains', meta, autoload = True)
mailalias = Table(
'mailalias', meta,
Column('mailaliasid', Integer, primary_key = True),
Column('domainid', Integer, ForeignKey('domains.id'), nullable = False),
Column('email', String(255), nullable = False),
Column('target', TEXT, nullable = False),
UniqueConstraint('email', 'domainid'))
mailpassword = Table(
'mailpassword', meta,
Column('id', String(18), primary_key = True),
Column('domainid', Integer, ForeignKey('domains.id'), nullable = False),
Column('uid', Integer, nullable = False),
Column('gid', Integer, nullable = False),
Column('home', String(255), nullable = False),
Column('cryptpass', String(34), nullable = False),
Column('clearpass', String(64), nullable = False),
Column('spamcheck', Boolean, default = False),
Column('sajunkscore', Integer))
def upgrade():
mailalias.create()
mailpassword.create()
def downgrade():
mailpassword.drop()
mailalias.drop()

View file

@ -0,0 +1,40 @@
from sqlalchemy import *
from migrate import *
meta = BoundMetaData(migrate_engine)
client_table = Table(
'client', meta,
Column('clientid', Integer, primary_key = True),
Column('firstname', String(40), nullable = False),
Column('lastname', String(40), nullable = False),
Column('address1', String(40), nullable = False),
Column('address2', String(40)),
Column('country', String(40)),
Column('town', String(50), nullable = False),
Column('zipcode', String(5), nullable = False),
Column('state', String(40)),
Column('active', Boolean, default = False, nullable = False),
Column('phone', String(20)),
Column('mobile', String(20)))
sysuser_table = Table(
'sysuser', meta,
Column('sysuserid', Integer, primary_key = True),
Column('name', String(12), nullable = False),
Column('type', Integer, default = 0, nullable = False),
Column('home', String(128)),
Column('shell', Boolean),
Column('password', String(64)),
Column('clientid', Integer, ForeignKey('client.clientid'),
nullable = False),
Column('toupdate', Boolean, default = False, nullable = False),
Column('md5pass', String(34)),
Column('sysuid', Integer))
def upgrade():
client_table.create()
sysuser_table.create()
def downgrade():
sysuser_table.drop()
client_table.drop()

View file

@ -0,0 +1,17 @@
from sqlalchemy import *
from migrate import *
import migrate.changeset
meta = BoundMetaData(migrate_engine)
sysuser = Table('sysuser', meta, autoload = True)
domains = Table('domains', meta, autoload = True)
sysuidrefcol = Column('sysuserid', Integer,
ForeignKey('sysuser.sysuserid'),
nullable = False)
def upgrade():
sysuidrefcol.create(domains)
def downgrade():
col = domains.c.sysuserid
col.drop()