This needs to go into sql/schema-postgresql.sql.
For upgrading, there is no proper infrastructure. mb/mb/conn.py contains the code that
loads the ORM (object relational mapper) models, and I used that for the last big
upgrade (2.13.0). If the hashes table doesn't exist, it is created (among other
Better would be to have a little table with a version number. That could be checked at
each start with low overhead. Depending on the version number, needed upgrades could
That should be solved first I think. Otherwise the mess that I already created becomes
But as it seems trivial to implement to me, I don't think it's a significant hurdle.
(It just prevents me from including the new view right now...)
A useful view that could be included in the default schema.
Nothing useful (at the moment) for MB, but it's been useful to me when scripting
other things using the MB database.
CREATE OR REPLACE VIEW file_hashes AS
SELECT "substring"(file.path::text, '^.+/'::text) AS path,
"substring"(file.path::text, '[^/]+$'::text) AS filename, hash.mtime,
hash.md5hex, hash.sha1hex, hash.sha256hex
FROM hexhash hash
JOIN filearr file ON hash.file_id = file.id;