[Qa-debsources] DB modification for cloc plugin
Orestis Ioannou
orestis at oioannou.com
Thu Apr 14 21:30:32 UTC 2016
Heya
On 04/13/2016 05:18 PM, Stefano Zacchiroli wrote:
> On Wed, Apr 13, 2016 at 10:24:20AM +0200, Matthieu Caneill wrote:
>> Thanks for working on this!
>
> Hear, hear.
>
>> Since it's about cloc, and not likely to change (other kind of meta
>> information should be added in the future directly in the Files
>> table), I would suggest file_cloc.
>
> Or, if you feel funny enough, we can use cloccounts, which is just one
> character away from sloccounts, but is incidentally also very
> semantically appropriate. I think with indexes doing the aggregate by
> package would actually be really fast, and could be done on the fly,
> rather than having a separate dedicated table. It's worth being tested,
> but I'm actually pretty confident it'd work fine.
cloccounts seems good to me :)
Do we need a package_id in the table for the indexes or this is not what
you meant?
>
> Yeah, definitely.
>
>>> CREATE TABLE file_metas (
>>> id SERIAL NOT NULL,
>>> file_id BIGINT NOT NULL,
>>> code Integer NOT NULL,
>>> comment Integer,
>>> language languages NOT NULL,
>>> CONSTRAINT file_metas_file_id_fkey
>>> FOREIGN KEY (file_id) REFERENCES files(id)
>>> ON DELETE CASCADE,
>>> PRIMARY KEY (id)
>>> );
>>
>> * We should create a UNIQUE constraint for (file_id, language);
>
> ... and drop id, yes (unless you can think of specific reasons why we
> would event want to point to a specific line count entry).
>
> Question: can cloc actually return multiple languages for the same file?
>
> (The above constraint seems to conservatively assume that it could,
> which is a nice assumption for the DB, but I'm curious anyhow)
>
So the thing is that i thought it could return many languages per file.
For example a html file with some php in it etc. But i tested this today
and its not working like tihs. But at the beginnning this is why i
thought of an id because the unique constraint wouldn't work.
I ll ask the author about this and modify accordingly.
>> * I would append the suffix _count to code and comment;
>> * Why drop the blank lines count of cloc? FWIW, once we have it it's
>> almost free to store.
>
> *nod*
>
ACK. Thanks again both of you for the review :)
Orestis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/qa-debsources/attachments/20160414/e2d938de/attachment.sig>
More information about the Qa-debsources
mailing list