Store used language for processing on attachmentmeta

Issue: #570
This commit is contained in:
Eike Kettner
2021-01-15 23:30:49 +01:00
parent 6cf3f9be5a
commit a70e9ab614
9 changed files with 113 additions and 14 deletions

View File

@ -0,0 +1,35 @@
ALTER TABLE "attachmentmeta"
ADD COLUMN "language" varchar(254);
update "attachmentmeta"
set "language" = 'deu'
where "attachid" in (
select "m"."attachid"
from "attachmentmeta" m
inner join "attachment" a on "a"."attachid" = "m"."attachid"
inner join "item" i on "a"."itemid" = "i"."itemid"
inner join "collective" c on "c"."cid" = "i"."cid"
where "c"."doclang" = 'deu'
);
update "attachmentmeta"
set "language" = 'eng'
where "attachid" in (
select "m"."attachid"
from "attachmentmeta" m
inner join "attachment" a on "a"."attachid" = "m"."attachid"
inner join "item" i on "a"."itemid" = "i"."itemid"
inner join "collective" c on "c"."cid" = "i"."cid"
where "c"."doclang" = 'eng'
);
update "attachmentmeta"
set "language" = 'fra'
where "attachid" in (
select "m"."attachid"
from "attachmentmeta" m
inner join "attachment" a on "a"."attachid" = "m"."attachid"
inner join "item" i on "a"."itemid" = "i"."itemid"
inner join "collective" c on "c"."cid" = "i"."cid"
where "c"."doclang" = 'fra'
);

View File

@ -0,0 +1,14 @@
ALTER TABLE `attachmentmeta`
ADD COLUMN (`language` varchar(254));
update `attachmentmeta` `m`
inner join (
select `m`.`attachid`, `c`.`doclang`
from `attachmentmeta` m
inner join `attachment` a on `a`.`attachid` = `m`.`attachid`
inner join `item` i on `a`.`itemid` = `i`.`itemid`
inner join `collective` c on `c`.`cid` = `i`.`cid`
) as `c`
set `m`.`language` = `c`.`doclang`
where `m`.`attachid` = `c`.`attachid` and `m`.`language` is null;

View File

@ -0,0 +1,15 @@
ALTER TABLE "attachmentmeta"
ADD COLUMN "language" varchar(254);
with
"attachlang" as (
select "m"."attachid", "m"."language", "c"."doclang"
from "attachmentmeta" m
inner join "attachment" a on "a"."attachid" = "m"."attachid"
inner join "item" i on "a"."itemid" = "i"."itemid"
inner join "collective" c on "c"."cid" = "i"."cid"
)
update "attachmentmeta" as "m"
set "language" = "c"."doclang"
from "attachlang" c
where "m"."attachid" = "c"."attachid" and "m"."language" is null;