mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-07-04 16:48:26 +00:00
Control what tag categories to use for auto-tagging
This commit is contained in:
@ -14,8 +14,31 @@ select random_uuid() as "id", "cid", concat('tagcategory-', "category") as "name
|
||||
from "classifier_setting"
|
||||
where "file_id" is not null;
|
||||
|
||||
alter table "classifier_setting"
|
||||
add column "categories" text;
|
||||
|
||||
alter table "classifier_setting"
|
||||
add column "category_list_type" varchar(254);
|
||||
|
||||
update "classifier_setting"
|
||||
set "category_list_type" = 'whitelist';
|
||||
|
||||
update "classifier_setting"
|
||||
set "categories" = concat('["', category, '"]')
|
||||
where category is not null;
|
||||
|
||||
update "classifier_setting"
|
||||
set "categories" = '[]'
|
||||
where category is null;
|
||||
|
||||
alter table "classifier_setting"
|
||||
drop column "category";
|
||||
|
||||
alter table "classifier_setting"
|
||||
drop column "file_id";
|
||||
|
||||
ALTER TABLE "classifier_setting"
|
||||
ALTER COLUMN "categories" SET NOT NULL;
|
||||
|
||||
ALTER TABLE "classifier_setting"
|
||||
ALTER COLUMN "category_list_type" SET NOT NULL;
|
||||
|
@ -14,13 +14,35 @@ select md5(rand()) as id, `cid`,concat('tagcategory-', `category`) as `name`, `f
|
||||
from `classifier_setting`
|
||||
where `file_id` is not null;
|
||||
|
||||
alter table `classifier_setting`
|
||||
add column (`categories` mediumtext);
|
||||
|
||||
alter table `classifier_setting`
|
||||
add column (`category_list_type` varchar(254));
|
||||
|
||||
update `classifier_setting`
|
||||
set `category_list_type` = 'whitelist';
|
||||
|
||||
update `classifier_setting`
|
||||
set `categories` = concat('[`', category, '`]')
|
||||
where category is not null;
|
||||
|
||||
update `classifier_setting`
|
||||
set `categories` = '[]'
|
||||
where category is null;
|
||||
|
||||
alter table `classifier_setting`
|
||||
drop column `category`;
|
||||
|
||||
-- mariadb needs special treatment when dropping a column that is part
|
||||
-- of an index and foreign key
|
||||
-- mariadb requires to drop constraint manually when dropping a column
|
||||
alter table `classifier_setting`
|
||||
drop constraint `classifier_setting_ibfk_2`;
|
||||
|
||||
alter table `classifier_setting`
|
||||
drop column `file_id`;
|
||||
|
||||
ALTER TABLE `classifier_setting`
|
||||
MODIFY `categories` mediumtext NOT NULL;
|
||||
|
||||
ALTER TABLE `classifier_setting`
|
||||
MODIFY `category_list_type` varchar(254) NOT NULL;
|
||||
|
@ -14,8 +14,31 @@ select md5(random()::text) as id, "cid",'tagcategory-' || "category" as "name",
|
||||
from "classifier_setting"
|
||||
where "file_id" is not null;
|
||||
|
||||
alter table "classifier_setting"
|
||||
add column "categories" text;
|
||||
|
||||
alter table "classifier_setting"
|
||||
add column "category_list_type" varchar(254);
|
||||
|
||||
update "classifier_setting"
|
||||
set "category_list_type" = 'whitelist';
|
||||
|
||||
update "classifier_setting"
|
||||
set "categories" = concat('["', category, '"]')
|
||||
where category is not null;
|
||||
|
||||
update "classifier_setting"
|
||||
set "categories" = '[]'
|
||||
where category is null;
|
||||
|
||||
alter table "classifier_setting"
|
||||
drop column "category";
|
||||
|
||||
alter table "classifier_setting"
|
||||
drop column "file_id";
|
||||
|
||||
ALTER TABLE "classifier_setting"
|
||||
ALTER COLUMN "categories" SET NOT NULL;
|
||||
|
||||
ALTER TABLE "classifier_setting"
|
||||
ALTER COLUMN "category_list_type" SET NOT NULL;
|
||||
|
Reference in New Issue
Block a user