This commit is contained in:
Dmitry Zuikov 2024-05-14 07:07:43 +03:00
parent 6ab782f385
commit f561fb0ce4
2 changed files with 34 additions and 8 deletions

View File

@ -9,7 +9,7 @@ fixme-prefix TODO:
fixme-prefix PR:
fixme-prefix REVIEW:
fixme-git-scan-filter-days 100
fixme-git-scan-filter-days 365
fixme-attribs assigned workflow

View File

@ -142,22 +142,48 @@ createTables = do
ddl [qc| drop view if exists fixmeattrview |]
let commits = [qc|name in ('commit','committer','committer-name','committer-email','commit-time')|] :: Text
ddl [qc|
create view fixmeattrview as
with ranked as (
with ranked1 as (
select
fixme,
name,
value,
row_number() over (partition by fixme, name order by ts desc nulls first) as rn
from fixmeattr
where not ({commits})
),
ranked2 as (
select
fixme,
name,
value,
row_number() over (partition by fixme, name order by ts asc nulls last) as rn
from fixmeattr
where ({commits})
)
select distinct fixme,name,value
from
(
select
fixme,
name,
value
from ranked1
where rn = 1
union
select
fixme,
name,
value
from ranked2
where rn = 1
)
select
fixme,
name,
value
from ranked
where rn = 1;
|]
ddl [qc|drop view if exists fixmeactualview|]