X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=schema%2Fsyncconflicts.sql;fp=schema%2Fsyncconflicts.sql;h=eddb9d1e8c505d07211225a82bccb54849c5a34c;hb=b3c05e3e2a4b5cf159a2ab94b1c6696ceeb8c1a8;hp=0000000000000000000000000000000000000000;hpb=b53647c07cf58ed2a8b76727f22cf5328c6e02fb;p=zpackage diff --git a/schema/syncconflicts.sql b/schema/syncconflicts.sql new file mode 100644 index 0000000..eddb9d1 --- /dev/null +++ b/schema/syncconflicts.sql @@ -0,0 +1,35 @@ +create view syncconflicts as +with +-- metadata different +md_conflict as ( + select path, count(distinct + printf('%s:%s:%s:%s', PFA.filetype, PFA.mode, PFA.username, PFA.groupname)) as mdcount, + count(distinct PFA.hash) as hashcount + from packagefiles PFA + join packages PA + on PA.package = PFA.package and PA.version = PFA.version and PA.release = PFA.release + where PA.status in ('installing', 'installed') + group by path + having (count(distinct printf('%s:%s:%s:%s', PFA.filetype, PFA.mode, PFA.username, PFA.groupname) + ) > 1 or count(distinct PFA.hash) > 1) +) +select PFH.*, + printf('%s-%s-%s', PFH.package, PFH.version, PFH.release) as pkgid, + printf('%s:%s:%s:%s', PFH.filetype, PFH.mode, PFH.username, PFH.groupname) as mds, +'hash' as conflict +from packagefiles PFH + join packages PA + on PA.package = PFH.package and PA.version = PFH.version and PA.release = PFH.release +where path in (select path from md_conflict where hashcount > 1) + and PA.status in ('installing', 'installed') +union +select PFM.*, + printf('%s-%s-%s', PFM.package, PFM.version, PFM.release) as pkgid, + printf('%s:%s:%s:%s', PFM.filetype, PFM.mode, PFM.username, PFM.groupname) as mds, +'md' as conflict +from packagefiles PFM + join packages PA + on PA.package = PFM.package and PA.version = PFM.version and PA.release = PFM.release +where path in (select path from md_conflict where hashcount > 1) + and PA.status in ('installing', 'installed') +;