globaleaks/GLBackend — pull request #140 by evilaliv3 (2013-08-13 21:56:43+00:00)
Title: first commit to address issue/316

This pull request is not ready for merge but i'm opening it now as i'm encountering some problems to investigate:

@vecna / @hellais as you can see in this first commit i'm simply trying to do a migrate script for table User with a simple variable name change:

fist_failed_login -> last_failed_attempt

but i got this error:
Performing update of Database from version 5 to version 6
Updating DB from version 5 to version 6
[5 => 6] Opening old version DB: /data/devel/globaleaks/GLBackend/workingdir/db/glbackend-5.db
[5 => 6] default Node migration assistant
[5 => 6] User migration assistant: #2
[5 => 6] default Context migration assistant: #1
[5 => 6] default ReceiverTip migration assistant: #0
[5 => 6] default WhistleblowerTip migration assistant: #0
[5 => 6] default Comments migration assistant: #0
[5 => 6] default InternalTips migration assistant: #1
[5 => 6] default Receivers migration assistant: #1
Failure in migrate_Receiver: no such column: user.last_failed_attempt
GlobaLeaks database version 6: update failure :(
Verbose exception traceback:
File "./bin/globaleaks", line 345, in check_db_files
updater_manager.perform_version_update(starting_ver, GLSetting.db_version, abspath)
File "/data/devel/globaleaks/GLBackend/globaleaks/db/updater_manager.py", line 81, in perform_version_update
function_pointer()
File "/data/devel/globaleaks/GLBackend/globaleaks/db/base_updater.py", line 447, in migrate_Receiver
new_obj.user_id = orcvr.user.id
File "/usr/local/lib/python2.7/dist-packages/storm/references.py", line 157, in __get__
self._relation.get_local_variables(local))
File "/usr/local/lib/python2.7/dist-packages/storm/store.py", line 194, in get
result = self._connection.execute(select)
File "/usr/local/lib/python2.7/dist-packages/storm/database.py", line 241, in execute
raw_cursor = self.raw_execute(statement, params)
File "/usr/local/lib/python2.7/dist-packages/storm/databases/sqlite.py", line 159, in raw_execute
return Connection.raw_execute(self, statement, params)
File "/usr/local/lib/python2.7/dist-packages/storm/database.py", line 374, in raw_execute
self._run_execution(raw_cursor, args, params, statement)
File "/usr/local/lib/python2.7/dist-packages/storm/database.py", line 388, in _run_execution
self._check_disconnect(raw_cursor.execute, *args)
File "/usr/local/lib/python2.7/dist-packages/storm/database.py", line 454, in _check_disconnect
return function(*args, **kwargs)

the problem is scattered by line 431 of db/base_updater.py https://github.com/globaleaks/GLBackend/blob/master/globaleaks/db/base_updater.py#L431

@hellais / @vecna: can you give high priority to test this as i think we probably have serious problem with migration scripts and references.