From d1836f4228fc540c460de38bf98ad1b775e2ee7d Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 21 Dec 2021 10:35:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=96=B0=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/dbsql/repo_foreigntable_for_es.sql | 14 +++++++++++++- routers/repo/ai_model_manage.go | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/models/dbsql/repo_foreigntable_for_es.sql b/models/dbsql/repo_foreigntable_for_es.sql index 0b09f576d..3637853cd 100644 --- a/models/dbsql/repo_foreigntable_for_es.sql +++ b/models/dbsql/repo_foreigntable_for_es.sql @@ -1,3 +1,4 @@ +DROP FOREIGN TABLE public.repository_es; CREATE FOREIGN TABLE public.repository_es ( id bigint NOT NULL, owner_id bigint, @@ -30,7 +31,7 @@ CREATE FOREIGN TABLE public.repository_es ( size bigint DEFAULT 0 NOT NULL, is_fsck_enabled boolean DEFAULT true NOT NULL, close_issues_via_commit_in_any_branch boolean DEFAULT false NOT NULL, - topics json, + topics text, avatar character varying(64), created_unix bigint, updated_unix bigint, @@ -145,6 +146,7 @@ LANGUAGE plpgsql; DROP TRIGGER IF EXISTS es_insert_repository on public.repository; + CREATE TRIGGER es_insert_repository AFTER INSERT ON public.repository FOR EACH ROW EXECUTE PROCEDURE insert_repository_data(); @@ -160,7 +162,17 @@ $def$ $def$ LANGUAGE plpgsql; + DROP TRIGGER IF EXISTS es_update_repository_description on public.repository; +DROP TRIGGER IF EXISTS es_update_repository_name on public.repository; +DROP TRIGGER IF EXISTS es_update_repository_ownername on public.repository; +DROP TRIGGER IF EXISTS es_update_repository_website on public.repository; +DROP TRIGGER IF EXISTS es_update_repository_topics on public.repository; +DROP TRIGGER IF EXISTS es_update_repository_updated_unix on public.repository; +DROP TRIGGER IF EXISTS es_update_repository_num_watches on public.repository; +DROP TRIGGER IF EXISTS es_update_repository_num_stars on public.repository; +DROP TRIGGER IF EXISTS es_update_repository_num_forks on public.repository; +DROP TRIGGER IF EXISTS es_delete_repository on public.repository; CREATE TRIGGER es_update_repository_description AFTER UPDATE OF "description" ON public.repository diff --git a/routers/repo/ai_model_manage.go b/routers/repo/ai_model_manage.go index da505d84e..22b551206 100644 --- a/routers/repo/ai_model_manage.go +++ b/routers/repo/ai_model_manage.go @@ -114,7 +114,8 @@ func SaveNewNameModel(ctx *context.Context) { aimodels := models.QueryModelByName(name, ctx.Repo.Repository.ID) if len(aimodels) > 0 { - ctx.ServerError("Name error.", errors.New(ctx.Tr("repo.model_noright"))) + ctx.Error(500, ctx.Tr("repo.model_rename")) + return } SaveModel(ctx)