그 플러그인에 대해 몰랐네요. 꽤 흥미롭네요! 설치되어 있지는 않지만, 데이터 컨테이너에 들어가서 쿼리를 실행할 수는 있습니다.
정말 좋은 단서네요! 다만 에러 메시지를 올바르게 이해하고 있다면, 해당 테이블은 theme_fields가 아닐 것 같습니다. 왜냐하면 그 특정 테이블에는 theme_field_id가 없기 때문입니다. 소스 코드를 확인해 보지는 않았지만, add_index()의 첫 번째 인수가 테이블 이름이고 두 번째 인수가 컬럼일 것이라고 추측해 봅니다.
그에 따르면, javascript_caches 테이블일 것 같습니다.
== 20230817174049 EnsureJavascriptCacheIsUniquePerTheme: migrating ============
-- remove_index(:javascript_caches, :theme_id)
-> 0.0208s
-- add_index(:javascript_caches, :theme_id, {:unique=>true})
-> 0.0079s
-- remove_index(:javascript_caches, :theme_field_id)
-> 0.0026s
-- add_index(:javascript_caches, :theme_field_id, {:unique=>true})
그래서 해당 테이블의 구조를 확인해 보니 theme_field_id 컬럼이 있습니다:
discourse=# \d javascript_caches
Table "public.javascript_caches"
Column | Type | Collation | Nullable | Default
----------------+-----------------------------+-----------+----------+-----------------------------------------------
id | bigint | | not null | nextval('javascript_caches_id_seq'::regclass)
theme_field_id | bigint | | |
digest | character varying | | |
content | text | | not null |
created_at | timestamp without time zone | | not null |
updated_at | timestamp without time zone | | not null |
theme_id | bigint | | |
source_map | text | | |
Indexes:
"javascript_caches_pkey" PRIMARY KEY, btree (id)
"index_javascript_caches_on_digest" btree (digest)
"index_javascript_caches_on_theme_field_id" btree (theme_field_id)
"index_javascript_caches_on_theme_id" btree (theme_id)
Check constraints:
"enforce_theme_or_theme_field" CHECK (theme_id IS NOT NULL AND theme_field_id IS NULL OR theme_id IS NULL AND theme_field_id IS NOT NULL)
Foreign-key constraints:
"fk_rails_58f94aecc4" FOREIGN KEY (theme_id) REFERENCES themes(id) ON DELETE CASCADE
"fk_rails_ed33506dbd" FOREIGN KEY (theme_field_id) REFERENCES theme_fields(id) ON DELETE CASCADE
해당 테이블을 쿼리할 수 있었습니다(읽을 수 있도록 콘텐츠 필드를 줄여서) 그리고 중복된 항목들을 볼 수 있습니다. 하지만 이 중복 항목들의 영향이 무엇인지 확실하지 않습니다.
discourse=# select id, theme_field_id, digest, substring(content from 1 for 64) as content_64, created_at, updated_at, theme_id, substring(source_map from 1 for 64) as source_64 from javascript_caches where theme_field_id = 3;
id | theme_field_id | digest | content_64 | created_at | updated_at | theme_id | source_64
----+----------------+------------------------------------------+------------------------------------------------------------------+----------------------------+----------------------------+----------+------------------------------------------------------------------
1 | 3 | d0b6ec642d5649064ff0501cadc775a9217b16e0 | "define"in window&&define("discourse/theme-3/initializers/theme- | 2019-02-25 01:26:56.606537 | 2023-08-18 20:47:19.596923 | | {"version":3,"sources":["discourse/initializers/theme-field-3-co
2 | 3 | 7fd74ecf4448afccdbcd9ccde87acddb4ec6f514 | "define"in window&&define("discourse/theme-3/initializers/theme- | 2019-02-25 01:26:58.228209 | 2023-08-18 20:50:41.049209 | | {"version":3,"sources":["discourse/initializers/theme-field-3-co
콘텐츠가 익숙해 보여서 Customize → Theme → My Theme → Common → Head로 들어가서 작은 수정을 하고 저장했는데, 항목 중 하나가 업데이트되고 다른 하나는 여전히 오래된 상태로 남아있는 것을 볼 수 있습니다…
discourse=# select id, theme_field_id, digest, substring(content from 1 for 64) as content_64, created_at, updated_at, theme_id, substring(source_map from 1 for 64) as source_64 from javascript_caches where theme_field_id = 3;
id | theme_field_id | digest | content_64 | created_at | updated_at | theme_id | source_64
----+----------------+------------------------------------------+------------------------------------------------------------------+----------------------------+----------------------------+----------+------------------------------------------------------------------
2 | 3 | 7fd74ecf4448afccdbcd9ccde87acddb4ec6f514 | "define"in window&&define("discourse/theme-3/initializers/theme- | 2019-02-25 01:26:58.228209 | 2023-08-18 20:50:41.049209 | | {"version":3,"sources":["discourse/initializers/theme-field-3-co
1 | 3 | 7f4132b1f9ced1b90b8f8fc24812cc11e81fea8d | "define"in window&&define("discourse/theme-3/initializers/theme- | 2019-02-25 01:26:56.606537 | 2023-09-13 21:56:56.312263 | | {"version":3,"sources":["discourse/initializers/theme-field-3-co
(2 rows)
다시 말하지만, 이 중복 항목들의 영향이 무엇인지, ‘오래된’ 항목을 삭제하는 것이 안전한지, 아니면 캐시를 '재구축’하여 이 문제를 정리할 다른 방법이 있는지 확실하지 않습니다.