[Qa-debsources] DB modification for cloc plugin

Matthieu Caneill matt at brokenwa.re
Wed Apr 13 08:24:20 UTC 2016


Hey Orestis,
Thanks for working on this!

On Sun, Apr 10, 2016 at 08:12:19PM +0200, Orestis Ioannou wrote:
> So i am wondering if we should add a cloc table that contains
> package-wide information in order to avoid using a sql sum query on the files table when
> doing statistics and plots. 

My 2 cents: yes. That way it will be trivial to compare sloccount anc
cloc, which can be interesting.

> I am not really fond of the name "file_metas" but my imagination stalled
> :D

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.

> I also don't know what to do as history_cloc. Were there any thoughts to
> implement this in a different way than the current implementation of the
> history_sloccount?

I think the current way is fine, but maybe Zack will have something to
add here.

> CREATE TYPE languages as ENUM(

s/languages/cloc_languages/?

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

Nice work overall!

Cheers,
--
Matthieu



More information about the Qa-debsources mailing list