From 6ce1563e890204221fe012e2c771516813811c2e Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Sat, 2 May 2009 14:54:15 +0200 Subject: [PATCH] renamed column "default" to "defchan" (default is a reserved word, bad karma), created a script to update the schema from v0.5 --- pyweb/mumble/models.py | 4 ++-- pyweb/update-v0.5-v0.6.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100755 pyweb/update-v0.5-v0.6.sh diff --git a/pyweb/mumble/models.py b/pyweb/mumble/models.py index 16d676a..3fa531f 100644 --- a/pyweb/mumble/models.py +++ b/pyweb/mumble/models.py @@ -41,7 +41,7 @@ class Mumble( models.Model ): obfsc = models.BooleanField( 'IP Obfuscation', default = False ); player = models.CharField( 'Player name regex', max_length=200, default=r'[-=\w\[\]\{\}\(\)\@\|\.]+' ); channel= models.CharField( 'Channel name regex', max_length=200, default=r'[ \-=\w\#\[\]\{\}\(\)\@\|]+' ); - default= models.IntegerField( 'Default channel', default=0 ); + defchan= models.IntegerField( 'Default channel', default=0 ); booted = models.BooleanField( 'Boot Server', default = True ); def getDbusMeta( self ): @@ -87,7 +87,7 @@ class Mumble( models.Model ): murmur.setConf( srvid, 'obfuscate', str(self.obfsc).lower() ); murmur.setConf( srvid, 'playername', self.player ); murmur.setConf( srvid, 'channelname', self.channel ); - murmur.setConf( srvid, 'defaultchannel', str(self.default) ); + murmur.setConf( srvid, 'defaultchannel', str(self.defchan) ); if self.port is not None: diff --git a/pyweb/update-v0.5-v0.6.sh b/pyweb/update-v0.5-v0.6.sh new file mode 100755 index 0000000..a68f357 --- /dev/null +++ b/pyweb/update-v0.5-v0.6.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Copyright (C) 2009, Michael "Svedrin" Ziegler +# +# Mumble-Django is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This package is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# I know this script sucks ass, thank you very much - but it should do the +# trick. It creates the columns in the database that have been added in v0.6. +# + +</dev/null +# -*- coding: utf-8 -*- +from django.db import connection +from django.conf import settings +crs = connection.cursor(); + +crs.execute( """ALTER TABLE mumble_mumble + ADD obfsc BOOLEAN NOT NULL DEFAULT 0, + ADD player VARCHAR(200) NOT NULL DEFAULT '%s', + ADD channel VARCHAR(200) NOT NULL DEFAULT '%s', + ADD defchan NOT NULL DEFAULT 0;""" % ( + r'[-=\\w\\[\\]\\{\\}\\(\\)\\@\\|\\.]+', + r'[ \\-=\\w\\#\\[\\]\\{\\}\\(\\)\\@\\|]+' ) +); +EOF