memory (sqlite): exit with an error if current db version is higher than version expected in current code
This commit is contained in:
parent
5cd41da237
commit
c05c65b1b3
1 changed files with 10 additions and 1 deletions
|
|
@ -21,7 +21,6 @@ from sat.core.i18n import _
|
|||
from sat.core.constants import Const as C
|
||||
from sat.core import exceptions
|
||||
from sat.core.log import getLogger
|
||||
log = getLogger(__name__)
|
||||
from sat.memory.crypto import BlockCipher, PasswordHasher
|
||||
from sat.tools.config import fixConfigOption
|
||||
from twisted.enterprise import adbapi
|
||||
|
|
@ -29,6 +28,7 @@ from twisted.internet import defer
|
|||
from twisted.words.protocols.jabber import jid
|
||||
from twisted.python import failure
|
||||
from collections import OrderedDict
|
||||
import sys
|
||||
import re
|
||||
import os.path
|
||||
import cPickle as pickle
|
||||
|
|
@ -36,6 +36,8 @@ import hashlib
|
|||
import sqlite3
|
||||
import json
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
CURRENT_DB_VERSION = 8
|
||||
|
||||
# XXX: DATABASE schemas are used in the following way:
|
||||
|
|
@ -1053,6 +1055,13 @@ class Updater(object):
|
|||
log.warning(_(u"Here are the commands that should fix the situation, use at your own risk (do a backup before modifying database), you can go to SàT's MUC room at sat@chat.jabberfr.org for help\n### SQL###\n%s\n### END SQL ###\n") % u'\n'.join("%s;" % statement for statement in update_raw))
|
||||
raise exceptions.DatabaseError("Database mismatch")
|
||||
else:
|
||||
if local_version > CURRENT_DB_VERSION:
|
||||
log.error(_(
|
||||
u"You database version is higher than the one used in this SàT "
|
||||
u"version, are you using several version at the same time? We "
|
||||
u"can't run SàT with this database."))
|
||||
sys.exit(1)
|
||||
|
||||
# Database is not up-to-date, we'll do the update
|
||||
if force_update:
|
||||
log.info(_("Database content needs a specific processing, local database will be updated"))
|
||||
|
|
|
|||
Loading…
Reference in a new issue