From 5125e98699e399af674a0e05a6661372c1478dfd Mon Sep 17 00:00:00 2001 From: eternal-flame-AD Date: Fri, 8 Nov 2024 09:45:58 -0600 Subject: [PATCH] update ci lint path Signed-off-by: eternal-flame-AD --- .forgejo/workflows/lint.yml | 4 ++-- update.sql | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 update.sql diff --git a/.forgejo/workflows/lint.yml b/.forgejo/workflows/lint.yml index 90eb268dda..4edebbce86 100644 --- a/.forgejo/workflows/lint.yml +++ b/.forgejo/workflows/lint.yml @@ -15,7 +15,7 @@ on: - packages/misskey-bubble-game/** - packages/misskey-reversi/** - packages/shared/eslint.config.js - - .github/workflows/lint.yml + - .forgejo/workflows/lint.yml pull_request: paths: - packages/backend/** @@ -27,7 +27,7 @@ on: - packages/misskey-bubble-game/** - packages/misskey-reversi/** - packages/shared/eslint.config.js - - .github/workflows/lint.yml + - .forgejo/workflows/lint.yml jobs: pnpm_install: runs-on: ubuntu-latest diff --git a/update.sql b/update.sql new file mode 100644 index 0000000000..b533b416fb --- /dev/null +++ b/update.sql @@ -0,0 +1,21 @@ +CREATE TEMPORARY TABLE "user_avatar_update" ( + "id" CHARACTER VARYING(32) PRIMARY KEY NOT NULL, + "updatedAvatarUrl" CHARACTER VARYING(512) NOT NULL +) + +CREATE INDEX "user_avatar_update_url" ON "user_avatar_update" ("updatedAvatarUrl") + +with typed as ( + select *, + case when "avatarUrl" ~ '%2Fproxy%2F' then 'nested' + when "avatarUrl" ~ '^https://mproxy\.mi\.yumechi\.jp' then 'proxied' + when "avatarUrl" ~ '^https://mi\.yumechi\.jp' then 'direct' + else 'unknown' end + AS proxy_type + FROM "user" WHERE "avatarUrl" IS NOT NULL) +INSERT INTO "user_avatar_update" ("id", "updatedAvatarUrl") +SELECT "id", 'https://mproxy.mi.yumechi.jp/' || SUBSTRING("avatarUrl" FROM 1 + LENGTH('https://mi.yumechi.jp/')) AS "updatedAvatarUrl" FROM typed WHERE proxy_type = 'direct' + +UPDATE "user" SET "avatarUrl" = "user_avatar_update"."updatedAvatarUrl" FROM "user_avatar_update" WHERE "user"."id" = "user_avatar_update"."id" + +SELECT typed."id", "avatarUrl", 'https://mproxy.mi.yumechi.jp/' || SUBSTRING("avatarUrl" FROM 1 + LENGTH('https://mi.yumechi.jp/')) AS aft from typed where proxy_type = 'direct' \ No newline at end of file