core (memory/sqlite): renamed column for files from hash to file_hash:
the version has not been changed to avoid too creating update for such a small change. Even if generally a database change means a version change, this one has not be wide spreaded, and it will be updated automatically for dev version. A manual "drop table files" using sqlite3 shell might clean things up though. The reason of the column name change is that hash is named file_hash in code (because "hash" is a reserved word), and using the same name simplify data manipulation.
This commit is contained in:
parent
ee7ad2bafe
commit
0d8938f92f
1 changed files with 5 additions and 5 deletions
|
|
@ -82,7 +82,7 @@ DATABASE_SCHEMAS = {
|
|||
('files', (("id TEXT NOT NULL", "version TEXT NOT NULL", "parent TEXT NOT NULL",
|
||||
"type TEXT CHECK(type in ('{file}', '{directory}')) NOT NULL DEFAULT '{file}'".format(
|
||||
file=C.FILE_TYPE_FILE, directory=C.FILE_TYPE_DIRECTORY),
|
||||
"hash TEXT", "hash_algo TEXT", "name TEXT NOT NULL", "size INTEGER",
|
||||
"file_hash TEXT", "hash_algo TEXT", "name TEXT NOT NULL", "size INTEGER",
|
||||
"namespace TEXT", "mime_type TEXT",
|
||||
"created DATETIME NOT NULL", "modified DATETIME",
|
||||
"owner TEXT", "access TEXT", "extra TEXT", "profile_id INTEGER"),
|
||||
|
|
@ -101,7 +101,7 @@ DATABASE_SCHEMAS = {
|
|||
5: {'create': {'files': (("id TEXT NOT NULL", "version TEXT NOT NULL", "parent TEXT NOT NULL",
|
||||
"type TEXT CHECK(type in ('{file}', '{directory}')) NOT NULL DEFAULT '{file}'".format(
|
||||
file=C.FILE_TYPE_FILE, directory=C.FILE_TYPE_DIRECTORY),
|
||||
"hash TEXT", "hash_algo TEXT", "name TEXT NOT NULL", "size INTEGER",
|
||||
"file_hash TEXT", "hash_algo TEXT", "name TEXT NOT NULL", "size INTEGER",
|
||||
"namespace TEXT", "mime_type TEXT",
|
||||
"created DATETIME NOT NULL", "modified DATETIME",
|
||||
"owner TEXT", "access TEXT", "extra TEXT", "profile_id INTEGER"),
|
||||
|
|
@ -696,7 +696,7 @@ class SqliteStorage(object):
|
|||
if unique:
|
||||
query_parts.append('DISTINCT')
|
||||
if projection is None:
|
||||
projection = ['id', 'version', 'parent', 'type', 'hash', 'hash_algo', 'name',
|
||||
projection = ['id', 'version', 'parent', 'type', 'file_hash', 'hash_algo', 'name',
|
||||
'size', 'namespace', 'mime_type', 'created', 'modified', 'owner',
|
||||
'access', 'extra']
|
||||
query_parts.append(','.join(projection))
|
||||
|
|
@ -717,7 +717,7 @@ class SqliteStorage(object):
|
|||
filters.append(u'type=?')
|
||||
args.append(type_)
|
||||
if file_hash is not None:
|
||||
filters.append(u'hash=?')
|
||||
filters.append(u'file_hash=?')
|
||||
args.append(file_hash)
|
||||
if hash_algo is not None:
|
||||
filters.append(u'hash_algo=?')
|
||||
|
|
@ -785,7 +785,7 @@ class SqliteStorage(object):
|
|||
"""
|
||||
if extra is not None:
|
||||
assert isinstance(extra, dict)
|
||||
query = ('INSERT INTO files(id, version, parent, type, hash, hash_algo, name, size, namespace, '
|
||||
query = ('INSERT INTO files(id, version, parent, type, file_hash, hash_algo, name, size, namespace, '
|
||||
'mime_type, created, modified, owner, access, extra, profile_id) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)')
|
||||
d = self.dbpool.runQuery(query, (file_id, version.strip(), parent, type_,
|
||||
file_hash, hash_algo,
|
||||
|
|
|
|||
Loading…
Reference in a new issue