Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a new sql view for files with separate paths and filenames #64

Open
poeml opened this issue Jun 5, 2015 · 0 comments
Open

a new sql view for files with separate paths and filenames #64

poeml opened this issue Jun 5, 2015 · 0 comments

Comments

@poeml
Copy link
Owner

poeml commented Jun 5, 2015

                                                                                      [          ]

Issue migrated (2015-06-05) from old issue tracker http://mirrorbrain.org/issues/issue64

Title    a new sql view for files with separate paths and filenames
 Priority   feature            Status      chatting
Superseder                   Nosy List     fukawi2, poeml
Assigned To                   Keywords

msg242 (view) Author: fukawi2 Date: 2010-09-17.11:47:08

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;

msg258 (view) Author: poeml Date: 2010-09-18.22:06:52

Very nice.

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
things).

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
be performed.

That should be solved first I think. Otherwise the mess that I already created becomes
even messier.

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...)

History
         Date          User   Action            Args
                                     status: unread -> chatting
2010-09-18 22:06:52 poeml   set    nosy: + poeml
                                     messages: + msg258
2010-09-17 11:47:09 fukawi2 create

(end of migrated issue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant